2

I'm trying to prevent close of fancybox when someone click outside of fancybox-content area.

HTML:

<div id="banner-message" style="display: none">
  <p>Hello World</p>
</div>

JS:

jQuery.fancybox.open(jQuery('#banner-message'), {
    clickOutside: false
});

DEMO: https://jsfiddle.net/xjw4b5jq/

RhymeGuy
  • 2,102
  • 5
  • 32
  • 62

2 Answers2

4

You have to use clickSlide option instead.

fancybox3 works as a slider and you can reposition/resize slider area, therefore there are two similar, but different options.

Janis
  • 8,593
  • 1
  • 21
  • 27
0

I have used this config to prevent closing the modal clicking outside.

<!--HTML-->

<a id="enlace" href="#modal">enlace</a>

<div id="modal">
   <p>Hola cracks</p>
</div>


// script

$("#enlace").fancybox({
   clickSlide: false,
   clickOutside: false
});

hope it works for u too :)

Jeff
  • 2,701
  • 2
  • 22
  • 35
DBS-JARR
  • 1
  • 1