如何防止 photoswipe 取消绑定我的滚动事件?

How can I prevent photoswipe to unbind my scroll event?

[情况] 我有关于 photoswipe close 的问题。我有一个 html 页面 A,使用 Photoswipe 查看照片。我在页面A中定义了一个滚动事件。当我打开然后关闭photoswipe并返回到我的页面A时,滚动事件不再起作用。

我的滚动事件:

$(window).scroll(function(){
  if ((getDocumentHeight() - getWindowHeight() - getSrollHeight()) == 0) {
    alert("buttom");
  };
});

我注意到 photoswipe 的 close 和 destory 方法调用 _unbindEvents 方法,它执行解除绑定功能。

// Closes the gallery, then destroy it
close: function() {
    if(!_isOpen) {
        return;
    }

    _isOpen = false;
    _isDestroying = true;
    _shout('close');
    _unbindEvents();

    _showOrHide( self.currItem, null, true, self.destroy);
},
// destroys gallery (unbinds events, cleans up intervals and timeouts to avoid memory leaks)
destroy: function() {
    _shout('destroy');

    if(_showOrHideTimeout) {
        clearTimeout(_showOrHideTimeout);
    }

    template.setAttribute('aria-hidden', 'true');
    template.className = _initalClassName;

    if(_updateSizeInterval) {
        clearInterval(_updateSizeInterval);
    }

    framework.unbind(self.scrollWrap, _downEvents, self);

    // we unbind lost event at the end, as closing animation may depend on it
    framework.unbind(window, 'scroll', self);

    _stopDragUpdateLoop();

    _stopAllAnimations();

    _listeners = null;
},
_unbindEvents = function() {
    framework.unbind(window, 'resize', self);
    framework.unbind(window, 'scroll', _globalEventHandlers.scroll);
    framework.unbind(document, 'keydown', self);
    framework.unbind(document, 'mousemove', _onFirstMouseMove);

    if(_features.transform) {
        framework.unbind(self.scrollWrap, 'click', self);
    }

    if(_isDragging) {
        framework.unbind(window, _upMoveEvents, self);
    }

    _shout('unbindEvents');
},

[问题] 如何防止 photoswipe 取消绑定我的滚动事件?

没用过photoswipe,但根据评论

// we unbind lost event at the end, as closing animation 'may' depend on it

如果删除该行会怎样?

framework.unbind(window, 'scroll', self);

我已经解决了这个问题。

$(document).scroll() 

而不是

$(window).scroll() 

有效。