Reputation: 13545
$("#slider").live("hover", function(e) {
if (e.type == 'mouseenter') {
$("#slider").delay(100).fadeIn();
}
else {
$("#slider").delay(1200).stop(true, true).fadeOut();
}
});
I used a slider in jQueryUI. What I would like to achieve is when the user hovers their mouse over the slider, it shows, and when the mouse is not hovered over it, it fades out. However, my case is after the first time of the fade out, the slider do not fade back in no matter where I put my mouse on that location of slider. How can I fix this problem? Thanks
Upvotes: 0
Views: 892
Reputation: 74738
This is another solution with mouseover
and mouseout
handlers with .animate()
method:
$("#slider").mouseover(function() {
$("#slider").stop().animate({"opacity":0},500);
}).mouseout(function() {
$("#slider").stop().animate({"opacity":1},500);
});
Upvotes: 0