Wordpress Uncaught ReferenceError: FastClick is not defined
Wordpress Uncaught ReferenceError: FastClick is not defined
我在联系表 7 中安装并激活了 WordPress 日期选择器插件以激活日期选择器
我在控制台 Wordpress Uncaught ReferenceError: FastClick is not defined 中收到并发出问题。
App.js
"use strict";
jQuery(function() {
return FastClick.attach(document.body), $(".back-to-top").on("click", function(t) {
return t.preventDefault(), $("html,body").animate({
scrollTop: 0
}, "500", "swing")
}), $(window).scroll(function() {
return $(window).scrollTop() >= 80 ? $("header").addClass("after-scroll") : $("header").removeClass("after-scroll")
}), $(window).width() > 1024 ? $.stellar({
horizontalScrolling: !1,
verticalOffset: 100
}) : void 0
});
听起来这个插件可能只是构造得不好,或者其他一些插件正在使 FastClick 脚本出队(无论出于什么奇怪的原因......),所以这种依赖性就消失了。
如果您愿意,一种选择是尝试将 FastClick 加入队列...
wp_enqueue_script('fastclick', 'https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js', array(), false, true);
你只需要确保它在这个插件的脚本之前加载,这样它就可以实际引用它并知道它存在。
就是说,这个插件听起来很糟糕。我不会用它。
将您的插件包装在下一行中,jquery 在 wordpress
中具有 jQuery 命名空间
(function($){
//the plugin js code
})(jQuery);
有时当您使用缓存或在 fastclick JS 之前加载的 jQuery 时,因为我们必须将其加载到 body 上,所以我们可以使用 windows.load
函数
window.onload = function() {
//code goes here
}
就我而言,我在子主题中使用 fastclick JS footer.php
。
我在联系表 7 中安装并激活了 WordPress 日期选择器插件以激活日期选择器
我在控制台 Wordpress Uncaught ReferenceError: FastClick is not defined 中收到并发出问题。
App.js
"use strict";
jQuery(function() {
return FastClick.attach(document.body), $(".back-to-top").on("click", function(t) {
return t.preventDefault(), $("html,body").animate({
scrollTop: 0
}, "500", "swing")
}), $(window).scroll(function() {
return $(window).scrollTop() >= 80 ? $("header").addClass("after-scroll") : $("header").removeClass("after-scroll")
}), $(window).width() > 1024 ? $.stellar({
horizontalScrolling: !1,
verticalOffset: 100
}) : void 0
});
听起来这个插件可能只是构造得不好,或者其他一些插件正在使 FastClick 脚本出队(无论出于什么奇怪的原因......),所以这种依赖性就消失了。
如果您愿意,一种选择是尝试将 FastClick 加入队列...
wp_enqueue_script('fastclick', 'https://cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js', array(), false, true);
你只需要确保它在这个插件的脚本之前加载,这样它就可以实际引用它并知道它存在。
就是说,这个插件听起来很糟糕。我不会用它。
将您的插件包装在下一行中,jquery 在 wordpress
中具有 jQuery 命名空间(function($){
//the plugin js code
})(jQuery);
有时当您使用缓存或在 fastclick JS 之前加载的 jQuery 时,因为我们必须将其加载到 body 上,所以我们可以使用 windows.load
函数
window.onload = function() {
//code goes here
}
就我而言,我在子主题中使用 fastclick JS footer.php
。