Setting jQuery Timeout on a div containing Flash
So, I need to remove a div once the flash has finished playing. I am using this so far (the first function is to show the flash div on hover, the 2nd to remove it.):
$(document).ready(function(){
$(".showFlash").hover(function () {
$("#flash").show("fast");
});
setTimeout(function() {
$('#flash').fadeOut('fast');}, 3000); //
});
It works fine the first time around. Though when I activate the flash again by hovering over the .showFlas开发者_如何学运维h element again - it doesn't work. Any ideas? Thanks.
No need to use timeout. Keep it simple
$(".showFlash").mouseenter(function () {
$("#flash").show("fast").delay(3000).fadeOut('fast');
});
Also I think you want to run this when mouse enters the .showFlash, not on hover (that triggers the event on enter and on exit)
精彩评论