diff --git a/.gitignore b/.gitignore index 1e0fc5a..f102d0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ */.DS_Store .DS_Store +/.idea/ diff --git a/css/jslider.css b/css/jslider.css index 0e604bd..9435bc3 100644 --- a/css/jslider.css +++ b/css/jslider.css @@ -17,9 +17,9 @@ .jslider .jslider-bg .r { width: 10%; left: 90%; background-position: right 0; } .jslider .jslider-bg .v { position: absolute; width: 60%; left: 20%; top: 0; height: 5px; background-repeat: repeat-x; background-position: 0 -40px; } - .jslider .jslider-pointer { width: 13px; height: 15px; background-position: 0 -60px; position: absolute; left: 20%; top: -4px; margin-left: -6px; cursor: pointer; cursor: hand; } - .jslider .jslider-pointer-hover { background-position: -20px -60px; } - .jslider .jslider-pointer-to { left: 80%; } + .jslider .jslider-pointer { width: 13px; height: 15px; background-position: 0 -60px; position: absolute; left: 20%; top: -4px; margin-left: -6px; cursor: pointer; cursor: hand; -ms-touch-action: none;} + .jslider .jslider-pointer-hover { background-position: -20px -60px; -ms-touch-action: none;} + .jslider .jslider-pointer-to { left: 80%; -ms-touch-action: none;} .jslider .jslider-label { font-size: 9px; line-height: 12px; color: black; opacity: 0.4; white-space: nowrap; padding: 0px 2px; position: absolute; top: -18px; left: 0px; } .jslider .jslider-label-to { left: auto; right: 0; } diff --git a/js/draggable-0.1.js b/js/draggable-0.1.js index 73273da..1b37830 100644 --- a/js/draggable-0.1.js +++ b/js/draggable-0.1.js @@ -76,7 +76,7 @@ Draggable.prototype._bindEvent = function( ptr, eventType, handler ){ var self = this; - if( this.supportTouches_ ) + if( this.supportTouches_ || this.supportMSPointers ) ptr.get(0).addEventListener( this.events_[ eventType ], handler, false ); else @@ -86,12 +86,13 @@ Draggable.prototype._events = function(){ var self = this; + this.supportMSPointers = window.navigator && window.navigator.msPointerEnabled; this.supportTouches_ = 'ontouchend' in document; this.events_ = { "click": this.supportTouches_ ? "touchstart" : "click", - "down": this.supportTouches_ ? "touchstart" : "mousedown", - "move": this.supportTouches_ ? "touchmove" : "mousemove", - "up" : this.supportTouches_ ? "touchend" : "mouseup" + "down": this.supportMSPointers ? "MSPointerDown" : (this.supportTouches_ ? "touchstart" : "mousedown"), + "move": this.supportMSPointers ? "MSPointerMove" : (this.supportTouches_ ? "touchmove" : "mousemove"), + "up" : this.supportMSPointers ? "MSPointerUp" : (this.supportTouches_ ? "touchend" : "mouseup") }; this._bindEvent( $( document ), "move", function( event ){