I’m trying to delay a function that I have in a jquery script from launching. I put in a settimeout but it isn’t taking for some reason, it breaks the rest of the script. Thanks in advance for any help I can get on this.
JS
<script type="text/javascript">
$(function () {
$("#fullscreen_launch").click(function () {
$("#fullscreen").animate({
height: '100%',
top: '0px',
}, 950, setTimeout(function () {
$('#fullscreen').load('http://www.klossal.com/portfolio/space_fullscreen.html');
}, 2000);
});
});
});
</script>
The last parameter to
animateis a callback.setTimeoutdoesn’t return a function, it returns a timeoutID (used forclearTimeout). You need to pass a function toanimate.