有没有办法动态添加已经打开的Magnific Popup中的图库项目? (或更新当前项目)。在plugin docs中找不到任何内容。
答案 0 :(得分:8)
是的,有可能:
// get instance (after popup was opened)
var mfp = $.magnificPopup.instance;
// modify the items array (push/remove/edit)
mfp.items.push({
src: "some-image.jpg"
});
// call update method to refresh counters (if required)
mfp.updateItemHTML();
关于放入items
数组的内容,请参阅文档 - http://dimsemenov.com/plugins/magnific-popup/documentation.html#from-the-items-option