jQuery - the option "blind" in "setInterval" still running
I added to my page this a part of code
setInterval(function() {
$('div.info').hide("blind", { direction: "vertical" }, 1000);
}, 2000);
If on a page exist div.info, so that div is displaying and after 2 seconds this div should be hidden with speed 1 seconds.
But I am struggling with problem, that this action is running over and over again - on the page is discovered div.info, after 2 seconds is this DIV hide and immediately is again displayed and afte开发者_如何学JAVAr another 2 seconds again hidden... And this is over and over again...
Can someone help me, please, why is this action still restarted? Thank you.
Try using setTimeout(function, delayInMilliseconds) instead of setInterval. setInterval sets a function to run every x milliseconds whereas setTimeout only runs once.
精彩评论