单击背景时禁用关闭弹出窗口
disable closing popup when clicking on background
我使用 featherlight.js 作为灯箱。当它打开并单击它的背景时,它会关闭弹出窗口。我需要禁用此功能。我注意到这个js有closeTrigger选项但是不知道怎么用
在文档中,您可以将其从默认设置中禁用
defaults: {
closeOnClick: false, /* Close lightbox on click ('background', 'anywhere', or false) */
}
里面有个默认选项:
closeOnClick: false /* Close lightbox on click ('background', 'anywhere', or false) */
Select "FALSE" 值这将禁止在点击背景时关闭弹出窗口。
谢谢,我写完问题后找到了解决方案,但谢谢大家。我的最终代码是这样的:
jQuery.featherlight(jQuery('#professional_investor_box'), {
closeOnClick:false,
});
我建议不要单独编写 javascript 代码段,因为您已经使用 "data" 属性 来初始化灯箱。
根据提供的文档,您可以在标记本身中设置 data-featherlight-close-on-click="false" 来实现同样的效果。
Fiddle - http://jsfiddle.net/ylokesh/c5pq5bs1/2/
HTML
<a class="btn btn-default" href="#" data-featherlight-close-on-click="false" data-featherlight="#fl1">Default</a>
<div class="lightbox" id="fl1">
<h2>Featherlight Default</h2>
<p>
This is a default featherlight lightbox.<br>
It's flexible in height and width.<br>
Everything that is used to display and style the box can be found in the
</p>
<a href="https://github.com/noelboss/featherlight/blob/master/src/featherlight.css">featherlight.css</a> file which is pretty simple.
</div>
使用此选项,您将无需编写单独的脚本块来启用此功能。
我使用 featherlight.js 作为灯箱。当它打开并单击它的背景时,它会关闭弹出窗口。我需要禁用此功能。我注意到这个js有closeTrigger选项但是不知道怎么用
在文档中,您可以将其从默认设置中禁用
defaults: {
closeOnClick: false, /* Close lightbox on click ('background', 'anywhere', or false) */
}
里面有个默认选项:
closeOnClick: false /* Close lightbox on click ('background', 'anywhere', or false) */
Select "FALSE" 值这将禁止在点击背景时关闭弹出窗口。
谢谢,我写完问题后找到了解决方案,但谢谢大家。我的最终代码是这样的:
jQuery.featherlight(jQuery('#professional_investor_box'), {
closeOnClick:false,
});
我建议不要单独编写 javascript 代码段,因为您已经使用 "data" 属性 来初始化灯箱。
根据提供的文档,您可以在标记本身中设置 data-featherlight-close-on-click="false" 来实现同样的效果。
Fiddle - http://jsfiddle.net/ylokesh/c5pq5bs1/2/
HTML
<a class="btn btn-default" href="#" data-featherlight-close-on-click="false" data-featherlight="#fl1">Default</a>
<div class="lightbox" id="fl1">
<h2>Featherlight Default</h2>
<p>
This is a default featherlight lightbox.<br>
It's flexible in height and width.<br>
Everything that is used to display and style the box can be found in the
</p>
<a href="https://github.com/noelboss/featherlight/blob/master/src/featherlight.css">featherlight.css</a> file which is pretty simple.
</div>
使用此选项,您将无需编写单独的脚本块来启用此功能。