Javascript Fancybox弹出关闭按钮未显示
知道为什么“关闭”按钮没有出现在我的新闻稿弹出框中吗 非常感谢Javascript Fancybox弹出关闭按钮未显示,javascript,jquery,html,fancybox,fancybox-2,Javascript,Jquery,Html,Fancybox,Fancybox 2,知道为什么“关闭”按钮没有出现在我的新闻稿弹出框中吗 非常感谢 <script type="text/javascript"> function openFancybox() { setTimeout(function () { $.fancybox('#newsletterpopup', { modal: true, // this prevents fancybox to close unless close unless ".
<script type="text/javascript">
function openFancybox() {
setTimeout(function () {
$.fancybox('#newsletterpopup', {
modal: true, // this prevents fancybox to close unless close unless ".non-merci" is clicked
showCloseButton: true,
helpers: {
overlay: {
css: {
'background': 'rgba(58, 42, 45, 0.3)'
}
}
},
afterShow: function () {
// enables a way to close fancybox
$(".non-merci").on("click", function () {
$.fancybox.close()
});
}
});
}, 1000);
};
$(document).ready(function () {
var visited = $.cookie('visited');
if (visited == 'yes') {
return false;
} else {
openFancybox();
}
$.cookie('visited', 'yes', {
expires: 0.0001
});
});
</script>
函数openFancybox(){
setTimeout(函数(){
$.fancybox(“#新闻稿弹出窗口”{
modal:true,//这将阻止fancybox关闭,除非单击“.non-merci”
showCloseButton:正确,
助手:{
覆盖:{
css:{
'背景':'rgba(58,42,45,0.3)'
}
}
},
余辉:函数(){
//启用关闭fancybox的方法
美元(“.non-merci”)。在(“单击”,函数(){
$.fancybox.close()
});
}
});
}, 1000);
};
$(文档).ready(函数(){
var visted=$.cookie(“visted”);
如果(已访问==“是”){
返回false;
}否则{
openFancybox();
}
$.cookie('已访问','是'{
过期日期:0.0001
});
});
尝试使用:
closeBtn:“
而不是showCloseButton
设置时,请尝试使用jQuery 1.8或更低版本,而不是1.10
modal: true
无论closeBtn
设置为true
,关闭按钮都不会显示
您可以删除modal
选项(默认值为false
),或者将其设置为false
请注意showCloseButton是fancybox v1.3.x的一个选项。它取决于您使用的工具。我使用gulp,我注意到文件(fancybox_sprite.png)在那里,但是路径可能是错误的,特别是如果您使用gulp为您编译。有时它们会被放错地方。在云中承载图像或更正文件路径
希望这有帮助。另外,如果您想确认您的配置是否正确,可以使用inspector检查是否有
.fancybox close
类。如果它在那里,那么这意味着您的路径没有指向png文件。根据最新的模式示例,您可以将关闭按钮与模式:true一起添加到DOM中
$('#时事通讯弹出窗口')。fancybox({
莫代尔:是的,
助手:{
覆盖:{
css:{
'背景':'rgba(58,42,45,0.3)'
}
}
},
});代码>
#TrueModel{
显示:无
}
你的内容
闭合模态
谢谢您的回答。问题是,如果我不将该框设置为模态,我将无法在新闻稿电子邮件字段中输入任何内容(根据您在本文中的建议)。还有别的办法吗?(关闭按钮并能够更新字段)。许多的thanks@Greg确保closeClick
设置为false
。了解更多