我使用featherlight輕量級jQuery燈箱插件,但我不明白如何使用點擊事件加載燈箱,因爲我不擅長jQuery代碼。jQuery的燈箱(羽毛燈)不工作與點擊事件
這裏是我的代碼工作:
HTML:
<a href="#" data-featherlight="#fl1">Load Lightbox</a>
<button id="openbox">Load Lightbox on click event</button>
<div class="lightbox" id="fl1">
<h2>Delete Item</h2>
<div class="row">
<div class="twelve columns">
<strong>Are you Sure?</strong>
<br>blubblub?
</div>
</div>
<div class="right"> <a href="#" class="btn btn_gray no text_none" id="close_button">Close</a>
<a href="#" class="btn btn_red text_none">Yes</a>
</div>
</div>
的jQuery:
jQuery(document).on("click", "#openbox", function() {
jQuery('.lightbox').featherlight();
});
的jsfiddle:jsfiddle.net/g68bZ/18/
評論回覆:
但是如果我想與像邏輯條件,以顯示收藏夾:
var checkedCount = $('.chkAssets:checked').length; // Getting some counts
if(checkedCount == 1){
// Load lightbox if condition is match
}
我希望有人指導我正確的方式。
謝謝。
提供撥弄鏈接工作.. – Gowri 2014-09-26 08:44:21
@Gowri對不起,我的錯誤。我正在更新我的jsfiddle。 – 2014-09-26 08:47:32
@Gowri嗨。我更新了小提琴。我想在按鈕點擊事件而不是默認錨鏈接上打開燈箱。這裏是我的小提琴鏈接'http:// jsfiddle.net/g68bZ/18 /' – 2014-09-26 08:52:54