How to change the background of an element using jQuery method .animate?
- 2https://jqueryui.com/animate here even with an example - hotfix
|
2 answers
$("#menu a").hover(function(){ $("#menu").css("background", "#f00"); }, function(){ $("#menu").css("background", "#00f"); }); - where is the
animatemethod? - Grundy - a bit off topic: I used this method, but I had ajax, and after a chain of requests when returning to the page where this code should work - it did not work, I decided to create a similar question with no seriousness, would you tell me how to deal with this?) - Maximmka
|
<div id="element" style="background-color:#fff; width:100px; height:100px;"></div> <script> $("#element").hover(function(){ $(this).animate({ backgroundColor: "#000"}, 1000); }); </script> |