I am trying to create a javascript banner. I have 3 images inside a div with ids # img1, # img2 n # img3.
<script src="scripts/jquery-latest.min.js" type="text/javascript"></script> <script> var AnimState = true; var AnimTime = 2000; var AnimDelay = 3000; $(document).ready( function() { $('#image img').hide(); $('#img3').show(); Show1(); }); function Show1() { if( AnimState === true ) { $("#img3").fadeOut(AnimTime); $("#img1").fadeIn(AnimTime, Show2); } } function Show2() { if( AnimState === true ) { $("#img1").fadeOut(AnimTime); $("#img2").fadeIn(AnimTime, Show3); } } function Show3() { if( AnimState === true ) { $("#img2").fadeOut(AnimTime); $("#img3").fadeIn(AnimTime, Show1); } } $('#btn1').click( function() { AnimState = !AnimState; Show1(); }); </script>
It works great. The only thing now I want to add a delay after the fadein effect, but I failed to try diff stuffs. So, what can be done to add a delay of several minutes, and then only call the next function, i.e. I want to add a delay after $("#img3").fadeIn(AnimTime) and after the delay call only the Show1() function
source share