Skip to content

Commit

Permalink
Merge pull request #1 from Kracht/master
Browse files Browse the repository at this point in the history
Added destroy.
  • Loading branch information
Matteo Spinelli committed Oct 10, 2011
2 parents 9586e3b + 6f8e361 commit 6062102
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/swipeview.js
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
};

Expand Down

0 comments on commit 6062102

Please sign in to comment.