Reputation: 68650
$("#notification").slideDown("slow").delay(2000).slideUp("slow");
.. works, but I want to add a condition so that if #notification is hovered, the timer/delay is stopped until mouseout. Then On mouseout the timer starts and then eventually the element is hidden (unless its not hovered again).
Thanks!
Upvotes: 0
Views: 1276
Reputation: 72222
If I understand you correctly, you wanna be able to stop the delay/animation if you hover the element?
Use clearQueue()
for that
$(document).ready(function() {
if(cookieIsPresent) {
$("#notification").hover(function() {
$(this).stop(true, true).clearQueue(); // You might not need to use clearQueue() but test it out
}, function() {
$(this).delay(2000).slideUp("slow");
}).slideDown("slow").delay(2000).slideUp("slow");
}
});
Upvotes: 2