使用Photoswipe gallery插件收听滑动/触摸事件

时间:2015-01-22 15:53:15

标签: javascript photoswipe

当图库发生变化时,会有一个特定的photoswipe事件会收听。

// After slides change
// (after content changed)
pswp.listen('afterChange', function() { });

我想知道是否有办法从左或右检测变化的方向。有没有人有想法?

http://photoswipe.com/documentation/api.html

1 个答案:

答案 0 :(得分:0)

您可以比较此事件处理程序中的索引,pswp.getCurrentIndex()将返回当前幻灯片索引。