本文介绍了jquery fancybox - 防止在fancybox外面点击关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的模态窗口使用插件。似乎无论我使用什么选项,当用户点击fancybox模态窗口(灰色区域)之外时,我无法阻止fancybox模态窗口关闭。

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 outside of the fancybox modal window (grayed out area).

有没有办法强制用户单击我触发关闭事件的X或按钮?这似乎应该很简单所以我希望我只是读错了这些例子。

Is there a way to force the user to click the X or a button that I trigger the close event? This seems like it should be simple so I'm hoping I'm just reading the examples wrong.

我试过 hideOnContentClick:false 但这似乎对我不起作用。有什么想法?

I've tried hideOnContentClick: false but that doesn't seem to be working for me. Any ideas?

推荐答案

没有选择。您将不得不更改源代码。

There is no option for that. You will have to change the source code.

在jquery.fancybox-1.2.1.js中,您需要在_finish方法中注释掉(或删除)第341行:

In jquery.fancybox-1.2.1.js you need to comment out (or delete) line 341 in the _finish method:

//$("#fancy_overlay, #fancy_close").bind("click", $.fn.fancybox.close);

这篇关于jquery fancybox - 防止在fancybox外面点击关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:25