Skip to content

Commit 270a1f8

Browse files
committed
Updated to work with jqLite/Ionic
Bound touchmove/mousemove to slider instead of document. Used $document.one to remove event on touchend/mouseup
1 parent 5e669dd commit 270a1f8

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

rzslider.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -784,13 +784,13 @@ function throttle(func, wait, options) {
784784

785785
if(event.touches || (typeof(event.originalEvent) != 'undefined' && event.originalEvent.touches))
786786
{
787-
$document.on('touchmove.rzslider', angular.bind(this, this.onMove, pointer));
788-
$document.on('touchend.rzslider', angular.bind(this, this.onEnd));
787+
this.sliderElem.on('touchmove', angular.bind(this, this.onMove, pointer));
788+
$document.one('touchend', angular.bind(this, this.onEnd));
789789
}
790790
else
791791
{
792-
$document.on('mousemove.rzslider', angular.bind(this, this.onMove, pointer));
793-
$document.on('mouseup.rzslider', angular.bind(this, this.onEnd));
792+
this.sliderElem.on('mousemove', angular.bind(this, this.onMove, pointer));
793+
$document.one('mouseup', angular.bind(this, this.onEnd));
794794
}
795795
},
796796

@@ -876,13 +876,11 @@ function throttle(func, wait, options) {
876876

877877
if(event.touches || (typeof(event.originalEvent) != 'undefined' && event.originalEvent.touches))
878878
{
879-
$document.unbind('touchmove.rzslider');
880-
$document.unbind('touchend.rzslider');
879+
this.sliderElem.off('touchmove');
881880
}
882881
else
883882
{
884-
$document.unbind('mousemove.rzslider');
885-
$document.unbind('mouseup.rzslider');
883+
this.sliderElem.off('mousemove');
886884
}
887885

888886
this.scope.$emit('slideEnded');

0 commit comments

Comments
 (0)