The hover() method takes two functions and is a combination of the mouseenter() and mouseleave() methods.
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(function(){ $("p").hover(function(){ $("p").css({"color":"green","backgroundColor":"orange","fontSize":"30px"}); }, function(){$("p").css({"color":"red","backgroundColor":"blue","fontSize":"40px"}); }); }); </script> </head> <body>
By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!p
Comments 0