I want to, under certain circumstances, hide an element which is currently fading in. This works in later versions of jQuery, but not in jQuery 1.4.2, which is the version the website I am working on is using, and cannot be upgraded. How can I get this working in 1.4.2?
HTML
<div class="fade">BLAH</div>
CSS
.fade {
display:none;
}
Javascript
$('.fade').show(1000);
setTimeout(function() {
$('.fade').hide();
}, 500);
Use
.stop()to stop the animation and clear the queue:Demo: http://jsfiddle.net/WcUUd/4/