image - 更新到 Worpdress 5.7 后,预加载器无法正常工作
问题描述
更新到 WP 5.7 后,我的 Preloader 停止工作。我在functions.php中有以下代码,以前可以正常工作。
// Preloader Code Header
add_action('wp_head', 'dp_preloader');
function dp_preloader() {
?>
<!-- Preloader -->
<div class="dp_preloader">
<div class="dp_loader_icon"> </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
}
解决方案
推荐阅读
- python - Django - 使用通用视图找不到 URL
- python - Python:如何用 ast 重载运算符
- html - Node.js + Cheerio Scraping:如何在联系表中发帖?
- css - 忽略所有父 CSS 的 Html 元素
- android - CollapsingToolbarLayout 将工具栏文本推到屏幕外。
- python - visual studio code - 用 python 编写的语言服务器扩展
- angular - @handsontable/angular:如何使用热列创建自动完成或可动手操作的类型
- mongodb - UpdateMany 方法总是返回零更新字段(Mongo C# 驱动程序)
- php - 从 PHP ms sql html 表生成 docx 文档
- react-native - react-native 0.56 更新后找不到“React/RCTPrimitives.h”文件