更新到 Worpdress 5.7 后预加载器不工作

问题描述

更新到 WP 5.7 后,我的预加载器停止工作。我在functions.PHP中有以下代码,以前工作正常。

// Preloader Code Header
add_action('wp_head','dp_preloader');
function dp_preloader() {
?>
    <!-- Preloader -->
    <div class="dp_preloader">
        <div class="dp_loader_icon">&nbsp;</div>
    </div>
    <style>
    .dp_preloader {position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: #ffffff;z-index: 999999;height: 100%;width: 100%;overflow: hidden !important;}
    .dp_preloader .dp_loader_icon {position: absolute;left: 50%;top: 50%;background-repeat: no-repeat;background-position: center;-webkit-background-size: cover;background-size: cover;background-image: url(<?PHP echo get_stylesheet_directory_uri();?>/img/preloader.gif);width: 64px;height: 64px;margin: 0px 0 0 -30px;}
    </style>
<?PHP 
}
// Preloader Code Footer
add_action('wp_footer','dp_preloader_css');
function dp_preloader_css() {
?>
    <script type="text/javascript">
        jQuery(window).load(function(){ 
            jQuery('.dp_loader_icon').fadeOut('fast'); 
            jQuery('.dp_preloader').delay(0).fadeOut('fast'); 
        })
    </script>
<?PHP
}
        

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)