【发布时间】:2012-07-12 10:30:38
【问题描述】:
如何调用 next/prev 方法?我需要将更多的按钮分开,无法按住工具栏中的所有按钮。
【问题讨论】:
标签: javascript jquery photoswipe
如何调用 next/prev 方法?我需要将更多的按钮分开,无法按住工具栏中的所有按钮。
【问题讨论】:
标签: javascript jquery photoswipe
看看the source code on Guthub,我不知道Photoswipe,但我看了一眼来源,发现如下:
/*
* Function: previous
*/
previous: function(){
if (this.isZoomActive()){
return;
}
if (!Util.isNothing(this.carousel)){
this.carousel.previous();
}
},
/*
* Function: next
*/
next: function(){
if (this.isZoomActive()){
return;
}
if (!Util.isNothing(this.carousel)){
this.carousel.next();
}
}
您可能想查看上面代码中引用的各个轮播函数。
【讨论】:
PhotoSwipe 文档向您展示了如何实例化代码:
// Set up PhotoSwipe with all anchor tags in the Gallery container
$(document).ready(function(){
var myPhotoSwipe = $("#Gallery a").photoSwipe({ enableMouseWheel: false , enableKeyboard: false });
});
要转到下一张图片,只需在您的 photoSwipe 实例上调用“next”即可:
myPhotoSwipe.next();
或“上一个”返回
myPhotoSwipe.previous();
Denoir 提到过(谢谢!)。
希望这会有所帮助。 干杯。
【讨论】: