简体   繁体   中英

Slider to start after page had fully loaded

Is there a way to start the full screen slider on my site after the preloader (query loader 2) has finished loading?

At the minute the preloader loads the page but once it has finished the slider is already half way through its first slide. What I would like is for the preloader to finish loading then the slider to start. Things I have tried:

1.) Changing the load order by adding the call to query loader to the top of the page and putting the slider call at the bottom of the page.

2.) jQuery.getScript() which loaded the scripts in order but the slider had already started before the preloader had finished. I tried document.ready() on the slider but this loaded it the same time as the preloader.

If you have any ideas as to where I'm going wrong here your help would be much appreciated.

I have put a link to my site as I didn't know which piece of code to add on here http://stavriaphotography.com

you can try setTimeout function of javascript.

setTimeout(function(){
    // your script code
},1000);

you can change 1000 by your specific time limit after which you want to load your script.

It's quite simple to make a function to check whether something has loaded. At a boolean to the function named 'loaded' and set its value to false. At the end of the preloader set its value to true. Then to start your slider, check whether loaded is true and if so: start the slider.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM