单击背景时禁用关闭弹出窗口
我使用featherlight.js作为灯箱。 当它打开并点击它的背景时,它会打开弹出窗口。 我需要禁用此function。 我注意到这个js中有closeTrigger选项,但不知道如何使用它。
它有一个默认选项:
closeOnClick: false /* Close lightbox on click ('background', 'anywhere', or false) */
选择“FALSE”值将禁用单击背景时关闭弹出窗口。
在文档中,您可以从默认值中禁用它
defaults: { closeOnClick: false, /* Close lightbox on click ('background', 'anywhere', or false) */ }
谢谢,我在写完问题后找到了解决方案,但谢谢大家。 我的最终代码看起来像这样:
jQuery.featherlight(jQuery('#professional_investor_box'), { closeOnClick:false, });
我建议您不要单独编写javascript代码段,因为您已经使用“data”属性来初始化灯箱。
根据提供的文档,您可以在标记本身中设置data-featherlight-close-on-click =“false”以实现相同的目的。
小提琴 – http://jsfiddle.net/ylokesh/c5pq5bs1/2/
HTML
Default Featherlight Default
This is a default featherlight lightbox.
It's flexible in height and width.
Everything that is used to display and style the box can be found in the
featherlight.css file which is pretty simple.
使用此选项,您将保存编写单独的脚本块以启用此function。