Javascript jQuery UI对话框未显示Squarespace adblock detect
我已经创建了一个AdBlock检测器,我的jQuery对话框似乎无法工作。注意:“adblock”变量已被引用。另外,我使用的是Squarespace,这就是为什么我必须将代码添加到主体中Javascript jQuery UI对话框未显示Squarespace adblock detect,javascript,jquery,html,jquery-ui,jquery-ui-dialog,Javascript,Jquery,Html,Jquery Ui,Jquery Ui Dialog,我已经创建了一个AdBlock检测器,我的jQuery对话框似乎无法工作。注意:“adblock”变量已被引用。另外,我使用的是Squarespace,这就是为什么我必须将代码添加到主体中 if(adblock) { $("body").html('<div id="alert-dialog" title="Turn off AdBlock"> Please turn your AdBlocker off. It hurts our business. To turn of
if(adblock) {
$("body").html('<div id="alert-dialog" title="Turn off AdBlock"> Please turn your AdBlocker off. It hurts our business. To turn off AdBlock, just disable it on this page. Thank you.<br><br><br> Sincerely, The <i>Wildwood Howl</i></div>'+$("body").html());
$(function() {
$( "#alert-dialog" ).dialog();
});
}
AKA未定义对话框
函数。我不知道为什么。这里是我添加的链接
和脚本
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
单击以查看我的页面。此外,应该有背景图像,但它们没有显示出来
我可以为此提供一个JSFIDLE。谢谢非常感谢您的帮助。问题可能是因为您添加了两次jQuery
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
---------------^ remove this
---------------^去掉这个
jQuery UI扩展了由jQuery-1.10.2
创建的$
,但随后添加了jQuery latest.min.js
,这可能会覆盖先前创建的具有jQuery UI功能的$
还要确保在计算这两个脚本并准备好DOM之后,您的代码运行正常
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
---------------^ remove this