When I hover the #PARENT div this script adds/removes class highlight to it. I want to add some grace to it by making this class(color/background-img really) fading, and here i fail, but why?
Fiddle for yours comfort: http://jsfiddle.net/4y4vQ/1/
<div id=PARENT>
<div id=CHILD>Content</div>
</div>
<script>
$("#PARENT").hover(function () {
$(this).fadeIn('slow', function() {
$("#PARENT").toggleClass("highlight");
});
});
</script>
You can use the jQuery UI Switch Class, This one will do exactly what you need
http://jqueryui.com/switchClass/