简体   繁体   中英

Load jquery preloader animation, earlier

I installed fakeLoader (jquery preloader) but I have trouble making it show before the page loads.

In mozilla it works almost fine (strangely...), but in Chrome and Opera, the page loads first and then the preloader animation takes place.

You could check my full source code here: http://morph.ellevenacoustica.com/

As the instructions in fakeloader website say, I load jquery 1.11.1 and fakeloader.js and .css in head. Then I place a <div id="fakeloader"></div> on top of body and then I load this script

<script language="javascript" type="text/javascript">$(document).ready(function(){$("#fakeloader").fakeLoader({ timeToHide:1200, zIndex:9999, spinner:"spinner1", bgColor:"#a01414" });});</script>

The full javascript of fakeloader.js can also be found at the link that I provided above.

I contacted the creator of the script at github but unfortunately I got no answer, so I rely on you to give me a helping hand!

I fixed it! I am proud of myself! :P

The correct code to be placed at the bottom is:

<script language="javascript" type="text/javascript">
(function ($) {
$("#fakeloader").fakeLoader({ 
timeToHide:1200, 
zIndex:9999, 
spinner:"spinner1", 
bgColor:"#a01414" 
});
}(jQuery));
</script>

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