Merge pull request #30 from maoziliang/master

Update the destroy method. Unbind listeners by event namespace.
This commit is contained in:
Hyunje Alex Jun 2013-06-01 20:40:34 -07:00
commit 2f6432d263

View File

@ -211,7 +211,7 @@
return true; return true;
}; };
$this.mousewheel(function (e, delta, deltaX, deltaY) { $this.bind('mousewheel.perfect-scroll', function (e, delta, deltaX, deltaY) {
$this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed)); $this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed));
$this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed)); $this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed));
@ -289,12 +289,8 @@
var destroy = function () { var destroy = function () {
$scrollbarX.remove(); $scrollbarX.remove();
$scrollbarY.remove(); $scrollbarY.remove();
$this.unbind('mousewheel'); $this.unbind('.perfect-scroll');
$this.unbind('touchstart.perfect-scroll'); $(window).unbind('.perfect-scroll');
$this.unbind('touchmove.perfect-scroll');
$this.unbind('touchend.perfect-scroll');
$(window).unbind('mousemove.perfect-scroll');
$(window).unbind('mouseup.perfect-scroll');
$this.data('perfect-scrollbar', null); $this.data('perfect-scrollbar', null);
$this.data('perfect-scrollbar-update', null); $this.data('perfect-scrollbar-update', null);
$this.data('perfect-scrollbar-destroy', null); $this.data('perfect-scrollbar-destroy', null);