jquery fancybox 2.0.3 - prevent close on click outside of fancybox
Use this option:
helpers : {
overlay : {closeClick: false}
}
so your final script should look like:
$(document).ready(function() {
$(".various").fancybox({
closeClick : false, // prevents closing when clicking INSIDE fancybox
openEffect : 'none',
closeEffect : 'none',
helpers : {
overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox
}
}).trigger("click");
});
hideOnOverlayClick
and hideOnContentClick
are options for Fancybox v1.3.x
The OP asked about fancyBox 2.0, but if you came here looking for an answer and are using fancyBox 3.0+, you can simply do:
$('.various').fancybox({
clickSlide: false, // disable close on outside click
touch: false // disable close on swipe
});
You can also completely disable the close button by adding smallBtn
and toolbar
to the options array and setting both to false
.
Tested with fancyBox 3.5.7.