我正在使用 magnific-popup,我想知道是否有办法禁用图库中第一个/最后一个项目上的箭头。
我已通读文档,但找不到有关此类功能的任何信息。
最佳答案
您不需要修改任何源文件,只需覆盖 prev/next 函数即可:
callbacks: {
open: function() {
var mfp = $.magnificPopup.instance;
var proto = $.magnificPopup.proto;
// extend function that moves to next item
mfp.next = function() {
// if index is not last, call parent method
if(mfp.index < mfp.items.length - 1) {
proto.next.call(mfp);
} else {
// otherwise do whatever you want, e.g. hide "next" arrow
}
};
// same with prev method
mfp.prev = function() {
if(mfp.index > 0) {
proto.prev.call(mfp);
}
};
}
}
关于jquery - 放大的弹出窗口 - 禁用第一个/最后一个项目上的箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16702994/