The .css()
function doesn’t queue behind running animations, it’s instantaneous.
To match the behaviour that you’re after, you’d need to do the following:
$(document).ready(function() { $("button").mouseover(function() { var p = $("p#44.test").css("background-color", "yellow"); p.hide(1500).show(1500); p.queue(function() { p.css("background-color", "red"); }); }); });
The .queue()
function waits for running animations to run out and then fires whatever’s in the supplied function.