diff options
author | Andrew Ozz <azaozz@git.wordpress.org> | 2012-04-11 02:20:51 +0000 |
---|---|---|
committer | Andrew Ozz <azaozz@git.wordpress.org> | 2012-04-11 02:20:51 +0000 |
commit | 3b9e5468e1719620c5bf8e76c255efbb0802bc4d (patch) | |
tree | 45a1eac0e255462ef72ce1350c7c3507ae5ef58f /wp-includes/js/jquery/jquery.ui.touch-punch.js | |
parent | 96a2b2be8aa686130213ecd70e314ec6129f8967 (diff) | |
download | wordpress-3b9e5468e1719620c5bf8e76c255efbb0802bc4d.tar.gz wordpress-3b9e5468e1719620c5bf8e76c255efbb0802bc4d.zip |
Add the jQuery UI Touch Punch plugin to handle dragging on mobile devices, props georgestephanis, see #20014
git-svn-id: https://develop.svn.wordpress.org/trunk@20433 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'wp-includes/js/jquery/jquery.ui.touch-punch.js')
-rw-r--r-- | wp-includes/js/jquery/jquery.ui.touch-punch.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/wp-includes/js/jquery/jquery.ui.touch-punch.js b/wp-includes/js/jquery/jquery.ui.touch-punch.js new file mode 100644 index 0000000000..bfbd04db8d --- /dev/null +++ b/wp-includes/js/jquery/jquery.ui.touch-punch.js @@ -0,0 +1,11 @@ +/* + * jQuery UI Touch Punch 0.2.2 + * + * Copyright 2011, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery); |