好像VisualLightBox在頁面加載時被初始化。您的鏈接是AJAX請求,因此在加載類別數據後即可上傳DOM內容。 VisualLightBox不知道被加載的新元素,所以它不適用於它們。你應該再次運行VisualLightBox,類別數據請求完成後:
jQuery(document).ready(function(){ window.Lightbox = new jQuery().visualLightbox({borderSize:10,classNames:'vlightbox1',descSliding:true,enableRightClick:true,enableSlideshow:false,prefix:'vlb1',resizeSpeed:9,slideTime:8,startZoom:true}) });
或者modidy當前vlbdata1.js腳本:
// function to load the lightbox
function init_visuallightbox() {
window.Lightbox = new jQuery().visualLightbox({ borderSize:10, classNames:'vlightbox1', descSliding:true, enableRightClick:true, enableSlideshow:false, prefix:'vlb1', resizeSpeed:9, slideTime:8, startZoom:true})
}
// tells browser to load lightbox on page change or load
jQuery(document).on('ready page:change', function() {
init_visuallightbox();
});
// tells browser to load lightbox after all ajax requests
$(document).ajaxComplete(function(event, xhr, settings) {
init_visuallightbox();
});
太謝謝你了! – Kicker 2015-02-10 14:33:40