简体   繁体   中英

Preloader not getting dismissed on timeout, jQuery

Strange issue with my website: the page loads normally when tested on local machine but after deployment the preloader (visible only on desktop) doesn't get dismissed.

The template that I'm editing uses jQuery 3.2.1

jQuery(window).load('body', function() {
    setTimeout(function() {
        jQuery('.mihi_tm_preloader').addClass('loaded');
    }, 1000);
});

Update:

1. After checking out, on my local machine it throws those errors in console: 本地机器错误

2. When deployed to server it gives those errors: 服务器错误

It looks like you're getting an error: "Uncaught TypeError: Cannot read property 'createDocumentFragment' of undefined" which is causing your jquery not to be executed.

Here's a link to help you figure out where your issue is or maybe post your jquery for more help.

Uncaught TypeError: Cannot read property 'createDocumentFragment' of undefined

Seems like the problem was with the jQuery(window).load('body', function() so i removed it and added a simple delay function:

function dismiss_preloader(){
    setTimeout(function() {
        jQuery('.mihi_tm_preloader').addClass('loaded');
    }, 1000);
}

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