웹 & 프레임워크

jQuery로 마우스반응 (hover)기능 구현하기 예제

늘근이 2014. 5. 22. 23:03

//함수형으로

             $(document).ready(function() {

                          

                           $("#content").on( {

                                       

                                        "mouseenter" : function() {

                                                     $(this).css("backgroundColor","pink");

                                        },

                                        "mouseleave" : function() {

                                                     $(this).css("backgroundColor","white");

                                        }

                           });

                          

 

             });

 

                           //일타쌍피 위에랑 같은 메서드다

                           $("#content").hover(function() {

                                        $(this).css("backgroundColor","pink");

             },function() {

                           $(this).css("backgroundColor","white");

             });