11
rated 0 times
[
18]
[
7]
/ answers: 1 / hits: 20582
/ 8 Years ago, mon, february 29, 2016, 12:00:00
I would like to set an interval of 5 seconds between each alert. Found this thread:
setInterval(function() {
alert(Message to alert every 5 seconds);
}, 5000);
But where do I put the setInterval()
in order to alert every 5 seconds?
$(window).scroll(function() {
if (checkVisible($('#footer'))) {
alert(I DONT SEE A FOOTER);
} else {
alert(EUREKA - I SEE A FOOTER);
}
});
function checkVisible(elm, eval) {
eval = eval || visible;
var vpH = $(window).height(), // Viewport Height
st = $(window).scrollTop(), // Scroll Top
y = $(elm).offset().top,
elementHeight = $(elm).height();
if (eval == visible)
return ((y < (vpH + st)) && (y > (st - elementHeight)));
if (eval == above)
return ((y < (vpH + st)));
}
Many thanks in advance.
More From » jquery