javascript - How do I add setTimeout to delay the fading animation in the following code? -
i'm using next fade in , fade out elements on hover
:
$(".hidden").hover(function() { $(this).animate({ opacity: 1 }); }, function() { $(this).animate({ opacity: 0 }); });
i add together delay between opacity 1
, opacity 0
(wait moment , fade out element).
how can accomplish that?
yuu can utilize .delay() function http://api.jquery.com/delay/.
$(".hidden").hover(function() { $(this).delay(1000).animate({ opacity: 1 }); }, function() { $(this).delay(1000).animate({ opacity: 0 }); });
http://jsfiddle.net/gk14nqrx/
javascript jquery css
No comments:
Post a Comment