jquery fancybox - prevent close on click outside of fancybox

后端 未结 15 931
独厮守ぢ
独厮守ぢ 2020-12-16 18:15

I\'m using the Fancybox plugin for my modal windows. It seems like no matter what options I use I can\'t prevent the fancybox modal window from closing when the user clicks

相关标签:
15条回答
  • 2020-12-16 18:55

    If you are using Fancybox 1.2.6 (like I am on a project), I found out the option hideOnOverlayClick. You can set it to false (e.g. hideOnOverlayClick: false).

    I found this option while exploring to modify the code based on the suggestion givn by Scott Dowding.

    0 讨论(0)
  • 2020-12-16 18:56

    you can prevent the fancy box to close by applying these setting

     'showCloseButton'=>false, // hide close button from fancybox
     'hideOnOverlayClick'=>false, // outside of fancybox click disabled
     'enableEscapeButton'=>false, // disable close on escape key press
    

    get the fancybox setting from following link

    http://www.fancybox.net/api

    0 讨论(0)
  • 2020-12-16 18:58

    Just use the following code:

    $(document).ready(function() {
      $("a#Mypopup").fancybox({
            "hideOnOverlayClick" : false, // prevents closing clicking OUTSIE fancybox
            "hideOnContentClick" : false, // prevents closing clicking INSIDE fancybox
            "enableEscapeButton" : false  // prevents closing pressing ESCAPE key
      });
      $("a#Mypopup").trigger('click');
    });
    
    <a id="Mypopup" href="images/popup.png"><img alt="Mypopup" src="images/popup.png" /></a>
    
    0 讨论(0)
提交回复
热议问题