【发布时间】:2016-06-30 02:08:09
【问题描述】:
我创建了一个数据表并将图像列添加到数据表中。当我单击图像时,我想在弹出窗口中打开图像。它适用于数据表的第一页,但是当我传递到第二页时,它不起作用。我也将 alert() 用于测试第二页事件并且 alert() 有效,但弹出窗口无效。
请查看我的 sn-ps: https://jsfiddle.net/f08qdeq2/20/
我该如何解决这个问题,有什么想法吗?谢谢你
$(document).ready(function() {
var table = $('#datatable').dataTable({
aLengthMenu: [
[1, 2],
[1, 2]
],
iDisplayLength: 1
});
});
$(this.document).ready(function() {
$('.image-popup').magnificPopup({
type: 'image',
closeOnContentClick: true,
closeBtnInside: false,
fixedContentPos: true,
image: {
verticalFit: true
},
zoom: {
enabled: true,
duration: 300 // don't foget to change the duration also in CSS
},
});
});
$(document).on('click', '.image-popup', function() {
alert('You Clicked Image');
//$('.image-popup-no-margins').magnificPopup({
//Some Working code here
//});
})
【问题讨论】:
标签: javascript jquery datatables magnific-popup