1
mirror of https://github.com/jakejarvis/spoons.git synced 2025-04-26 13:28:27 -04:00

Add jQuery Touch Punch to make drag and drop work on mobile devices. Fixes #4

This commit is contained in:
Mike Jaoudi 2013-05-19 20:39:16 -04:00
parent 39f4be98fe
commit 76e487c5ed
2 changed files with 13 additions and 1 deletions

11
assets/js/jquery.ui.touch-punch.min.js vendored Normal file
View File

@ -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);

View File

@ -170,7 +170,8 @@
<!-- Le JQuery -->
<script src="<?php echo $site_url ?>/assets/js/jquery.min.js"></script>
<script src="<?php echo $site_url ?>/assets/js/jquery-ui.min.js"></script>
<script src="<?php echo $site_url ?>/assets/js/jquery.ui.touch-punch.min.js"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="<?php echo $site_url ?>/assets/js/html5shiv.js"></script>