我使用featherlight.js作爲lightbox。當它被打開並且我點擊它的背景時,它會隱藏彈出窗口。我需要禁用此功能。我注意到,這個JS有closeTrigger選項,但不知道如何使用它。當點擊背景時禁用關閉彈出框
0
A
回答
2
這裏面一個默認選項:
closeOnClick: false /* Close lightbox on click ('background', 'anywhere', or false) */
選擇「FALSE」值,這將禁用點擊彈出閉幕在背景上。
1
在文檔中,你可以從它的默認禁用它
defaults: {
closeOnClick: false, /* Close lightbox on click ('background', 'anywhere', or false) */
}
1
謝謝,我在寫完我的問題後找到了解決辦法,但謝謝大家。我的最終代碼看起來是這樣的:
jQuery.featherlight(jQuery('#professional_investor_box'), {
closeOnClick:false,
});
1
我建議不要因爲你已經使用「數據」分開來寫JavaScript片段屬性初始化燈箱。
根據提供的文檔,您可以在標記本身中設置data-featherlight-close-on-click =「false」以實現相同。
小提琴 - 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>
使用此選項,您將節省編寫單獨的腳本塊只是啓用此功能。
相關問題
- 1. 當點擊背景時禁用fancyBox 2關閉
- 2. 當用戶單擊背景區域時,停止模式彈出框的關閉
- 3. 當div彈出時禁用背景
- 4. 當用戶點擊它時關閉WPF彈出框
- 5. 當自動彈出框顯示時禁用背景
- 6. 按鈕點擊後關閉彈出框
- 7. jquerymobile背景彈出框禁用觸摸
- 8. 點擊時關閉彈出菜單
- 9. 禁用點擊背景UIViewController
- 10. 當用戶點擊外部彈出窗口時關閉引導彈出窗口
- 11. 當打開另一個彈出框時關閉彈出框
- 12. 當點擊它時關閉對話框
- 13. 通過點擊背景關閉彩盒
- 14. 當點擊外部時,CMFCColorButton彈出窗口不關閉
- 15. 當彈出窗口打開時禁用背景
- 16. 點擊下一個彈出框時,第一個彈出窗口不會關閉
- 17. 當點擊彈出框的關閉按鈕時cookie沒有被設置
- 18. 當我點擊搜索圖標時如何禁用背景?
- 19. 對話框不會關閉背景/疊加點擊
- 20. 彈出窗口:當彈出彈出窗口時關閉彈出
- 21. 用戶點擊「Like」後關閉模態彈出框
- 22. 禁用關閉背景Tap Pop Swift
- 23. 彈出不再關閉再次點擊
- 24. 關閉通過點擊身體彈出
- 25. 防止彈出從關閉點擊wpf
- 26. 按鈕點擊關閉彈出問題
- 27. 當ApplicationBarMenuItem點擊時彈出一個彈出框
- 28. 當用戶在uisearchbar上點擊時禁用鍵盤彈出
- 29. 彈出式背景在關閉時不會隱藏
- 30. iOS:UIAlertView關閉當前彈出框
非常感謝Lokesh Yadav,它完美的工作 – aidadev