我想了解如何修改Magnific Popup代碼以控制創建的圖像陣列,以便從項目0(畫廊的第一個圖像)開始創建畫廊,但是從1畫廊的第二張圖片)。我需要改變畫廊中的邏輯。目前的行爲是當縮略圖從圖庫中點擊時彈出窗口畫廊與點擊縮略圖的圖像一起啓動。我需要使該數組中的下一張圖像被加載。說吧。我有一個4圖像的畫廊。縮略圖是畫廊中的第一張圖片。點擊我需要從圖庫中加載第二張圖片。任何幫助,高度讚賞!先謝謝你。Magnific Popup - 從第二個數組項目開始畫廊
以下是功能碼。
function lightbox() {
$('.lightbox').magnificPopup({
delegate: 'a',
type: 'image',
gallery:{
enabled:true,
arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"><img src="img/assets/slider-left-thin-arrow.png"></button>',
},
mainClass: 'mfp-zoom-in',
removalDelay: 500, //delay removal to allow out-animation
callbacks: {
beforeOpen: function() {
this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
}
},
closeMarkup: '<button title="%title%" type="button" class="mfp-close"></button>',
midClick: true
});
}
很好!它以我需要的方式工作。萬分感謝! – vladc77