Skip to content
Browse files

Merge pull request #1 from Kracht/master

Added destroy.
  • Loading branch information...
2 parents 9586e3b + 6f8e361 commit 6062102f7d7dbdb1875fc74b95ad29b79bb122e3 @cubiq committed Oct 10, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/swipeview.js
View
15 src/swipeview.js
@@ -30,6 +30,8 @@ var SwipeView = (function(){
this.wrapper.style.overflow = 'hidden';
this.wrapper.style.position = 'relative';
+ this.masterPages = [];
+
div = document.createElement('div');
div.style.cssText = 'position:relative;top:0;height:100%;width:100%;-webkit-transition-duration:0;-webkit-transform:translate3d(0,0,0);-webkit-transition-timining-function:ease-out';
this.wrapper.appendChild(div);
@@ -225,6 +227,19 @@ var SwipeView = (function(){
imageEl.height = this.options.pages[newIndex].height;
}
}
+ },
+
+ destroy: function () {
+ // Remove the event listeners
+ window.removeEventListener(resizeEvent, this, false);
+ this.wrapper.removeEventListener(startEvent, this, false);
+ this.wrapper.removeEventListener(moveEvent, this, false);
+ this.wrapper.removeEventListener(endEvent, this, false);
+ this.slider.removeEventListener('webkitTransitionEnd', this, false);
+
+ if (!hasTouch) {
+ this.wrapper.removeEventListener('mouseout', this, false);
+ }
}
};

0 comments on commit 6062102

Please sign in to comment.
Something went wrong with that request. Please try again.