fancybox禁止通过点击背景关闭窗口 Disable fancyBox 2 from closing when clicking the background

For version 2.x use

 $(".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

hideOnOverlayClick and hideOnContentClick are options for Fancybox v1.3.x

 

原文:http://stackoverflow.com/a/8404587/4484798