瀏覽代碼

Fixes a problem with setTimeout trying to run on an element that no longer exists.

Closes inuyaksa/jquery.nicescroll#469
Christoffer Vig 10 年之前
父節點
當前提交
fe96934065
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      jquery.nicescroll.js

+ 2 - 1
jquery.nicescroll.js

@@ -384,7 +384,7 @@
       var dd = self.delaylist[name];
       self.delaylist[name] = fn;
       if (!dd) {
-        setTimeout(function() {
+        self.debouncedelayed =  setTimeout(function() {
           var fn = self.delaylist[name];
           self.delaylist[name] = false;
           fn.call(self);
@@ -2488,6 +2488,7 @@
     this.remove = function() {
       self.stop();
       if (self.cursortimeout) clearTimeout(self.cursortimeout);
+      if (self.debouncedelayed) clearTimeout(self.debouncedelayed);
       self.doZoomOut();
       self.unbindAll();