In fancyBox 2, is there a key/value I could set that will disable the lightbox from closing when the user clicks the background (semi-transparent black background)?
在fancyBox 2中,是否有一个我可以设置的键/值,当用户点击背景(半透明的黑色背景)时,它会禁止灯箱关闭?
I only want to give them the option to click the actual (X) close button in the top right hand corner.
我只想让他们选择点击右上角的实际(X)关闭按钮。
Any ideas?
Thanks.
5 个解决方案
#1
44
For version 2.x use
对于2.x版本使用
$(".fancybox").fancybox({
closeClick : false, // prevents closing when clicking INSIDE fancybox
helpers : {
overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox
}
});
if closeClick
is set to true
(default) fancybox will close if clicking over the content so with these two combined options the only possible way to close fancybox is with the close
(X) button
如果closeClick设置为true(默认),如果点击内容,fancybox将关闭,因此使用这两个组合选项关闭fancybox的唯一可能方法是使用close(X)按钮
#2
6
This will disable closing fancybox when clicking on the overlay (the semi-transparent background)
这将在单击叠加层时禁用关闭fancybox(半透明背景)
fancyEls.fancybox({
helpers : {
overlay : {
closeClick: false
} // prevents closing when clicking OUTSIDE fancybox
}
});
This will disable all default click methods of closing fancybox
这将禁用关闭fancybox的所有默认点击方法
fancyEls.fancybox({
closeBtn : false,
closeClick : false,
helpers : {
overlay : {
closeClick: false
} // prevents closing when clicking OUTSIDE fancybox
},
keys : {
close: null
} // prevents close when clicking escape button
});
And this will do the same as well as disabling slideshow functionality
这将同样禁用幻灯片功能
fancyEls.fancybox({
modal : true //If set to true, will disable navigation and closing
});
#3
1
try this let adduser be my target selector
试试这个让adduser成为我的目标选择器
$('.adduser').fancybox({
'hideOnOverlayClick': false
});
#4
1
According to the Fancybox site API you could/should use
根据Fancybox网站API,您可以/应该使用
$.fancybox({
...
'hideOnOverlayClick' : false,
...
});
#5
0
To prevent close button- use:
为防止关闭按钮使用:
defaults: { closeBtn : false,}
To prevent overlay close - use :
为防止叠加关闭 - 使用:
F.helpers.overlay = {
defaults : {closeClick : false, // if true, fancyBox will be closed when user clicks on the overlay }}
To prevent escape click close :
要防止转义,请单击关闭:
defaults: {keys : {//close : [27], // escape key
close : null, } }
#1
44
For version 2.x use
对于2.x版本使用
$(".fancybox").fancybox({
closeClick : false, // prevents closing when clicking INSIDE fancybox
helpers : {
overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox
}
});
if closeClick
is set to true
(default) fancybox will close if clicking over the content so with these two combined options the only possible way to close fancybox is with the close
(X) button
如果closeClick设置为true(默认),如果点击内容,fancybox将关闭,因此使用这两个组合选项关闭fancybox的唯一可能方法是使用close(X)按钮
#2
6
This will disable closing fancybox when clicking on the overlay (the semi-transparent background)
这将在单击叠加层时禁用关闭fancybox(半透明背景)
fancyEls.fancybox({
helpers : {
overlay : {
closeClick: false
} // prevents closing when clicking OUTSIDE fancybox
}
});
This will disable all default click methods of closing fancybox
这将禁用关闭fancybox的所有默认点击方法
fancyEls.fancybox({
closeBtn : false,
closeClick : false,
helpers : {
overlay : {
closeClick: false
} // prevents closing when clicking OUTSIDE fancybox
},
keys : {
close: null
} // prevents close when clicking escape button
});
And this will do the same as well as disabling slideshow functionality
这将同样禁用幻灯片功能
fancyEls.fancybox({
modal : true //If set to true, will disable navigation and closing
});
#3
1
try this let adduser be my target selector
试试这个让adduser成为我的目标选择器
$('.adduser').fancybox({
'hideOnOverlayClick': false
});
#4
1
According to the Fancybox site API you could/should use
根据Fancybox网站API,您可以/应该使用
$.fancybox({
...
'hideOnOverlayClick' : false,
...
});
#5
0
To prevent close button- use:
为防止关闭按钮使用:
defaults: { closeBtn : false,}
To prevent overlay close - use :
为防止叠加关闭 - 使用:
F.helpers.overlay = {
defaults : {closeClick : false, // if true, fancyBox will be closed when user clicks on the overlay }}
To prevent escape click close :
要防止转义,请单击关闭:
defaults: {keys : {//close : [27], // escape key
close : null, } }