好像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