I am in the process of making a jquery application to hide an image after a specified interval of time by using setInterval(). The problem is that the hide image function executes immediately without delay.
$(document).ready(function() {
setInterval(change(), 99999999);
function change() {
$('#slideshow img').eq(0).removeClass('show');
}
});
I am testing it in jsfiddle.
http://jsfiddle.net/wWHux/3/
You called the function immediately instead of passing it to setInterval
.
setInterval( change, 1500 )
- passes function change
to setInterval
setInterval( change(), 1500 )
- calls the function change
and passes the result (undefined
) to setInterval
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With