|
9 | 9 | * Licensed under the MIT license
|
10 | 10 | */
|
11 | 11 |
|
12 |
| -/* global angular: false, window: false */ |
| 12 | +/* global angular: false */ |
13 | 13 |
|
14 | 14 | angular.module('rzModule', [])
|
15 | 15 |
|
@@ -843,13 +843,13 @@ function throttle(func, wait, options) {
|
843 | 843 |
|
844 | 844 | if(event.touches || (typeof(event.originalEvent) != 'undefined' && event.originalEvent.touches))
|
845 | 845 | {
|
846 |
| - $document.on('touchmove', angular.bind(this, this.onMove, pointer)); |
847 |
| - $document.on('touchend', angular.bind(this, this.onEnd)); |
| 846 | + this.sliderElem.on('touchmove', angular.bind(this, this.onMove, pointer)); |
| 847 | + $document.one('touchend', angular.bind(this, this.onEnd)); |
848 | 848 | }
|
849 | 849 | else
|
850 | 850 | {
|
851 |
| - $document.on('mousemove', angular.bind(this, this.onMove, pointer)); |
852 |
| - $document.on('mouseup', angular.bind(this, this.onEnd)); |
| 851 | + this.sliderElem.on('mousemove', angular.bind(this, this.onMove, pointer)); |
| 852 | + $document.one('mouseup', angular.bind(this, this.onEnd)); |
853 | 853 | }
|
854 | 854 | },
|
855 | 855 |
|
@@ -944,13 +944,11 @@ function throttle(func, wait, options) {
|
944 | 944 |
|
945 | 945 | if(event.touches || (typeof(event.originalEvent) != 'undefined' && event.originalEvent.touches))
|
946 | 946 | {
|
947 |
| - $document.unbind('touchmove'); |
948 |
| - $document.unbind('touchend'); |
| 947 | + this.sliderElem.off('touchmove'); |
949 | 948 | }
|
950 | 949 | else
|
951 | 950 | {
|
952 |
| - $document.unbind('mousemove'); |
953 |
| - $document.unbind('mouseup'); |
| 951 | + this.sliderElem.off('mousemove'); |
954 | 952 | }
|
955 | 953 |
|
956 | 954 | this.scope.$emit('slideEnded');
|
|
0 commit comments