当pswp图库关闭时,Photoswipe.js会检测事件

时间:2016-05-04 01:17:27

标签: javascript photoswipe

关闭Photoswipe时,it has some leftover elements on the DOM that breaks it,所以我想在每次关闭时使用jQuery重置它。如何在Photoswipe关闭时获取活动?

2 个答案:

答案 0 :(得分:0)

来自docs

// After gallery is closed and closing animation finished.
// Clean up your stuff here.
pswp.listen('destroy', function() { });

答案 1 :(得分:0)

您可以使用PhotoSwipe个事件。

// Event fire when Gallery starts closing
pswp.listen('close', function() { 
    // code here
});

// Even trigers when Gallery unbinds events
// (triggers before closing animation)
pswp.listen('unbindEvents', function() {
    // code here
});

// Event fires when only after the gallery is closed and closing animation finished.
pswp.listen('destroy', function() {
    // code here
});