Search This Blog

Sunday 4 November 2012

jQuery: .hover()

The function .hover() resumes the methods mouseenter and mouseleave. Let's assume that we have an hidden div in our CSS:
#effect{display:none;}
Our HTML code looks like this:

Move the mouse over me

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam fringilla hendrerit nisi et varius.
To show and hide the content of #effect the jQuery will be:
$("#mouseover").hover(
   function () 
   {
    $("#effect").fadeTo("slow",1);
   }, 
   function () 
   {
    $("#effect").fadeTo("slow",0);
 });
See the demo:

No comments:

Post a Comment