PHP Classes

File: engine/modules/contrib/foundation/js/plugins/foundation.util.touch.min.js

Recommend this page to a friend!
  Classes of Aldo Tripiciano   Quanta CMS   engine/modules/contrib/foundation/js/plugins/foundation.util.touch.min.js   Download  
File: engine/modules/contrib/foundation/js/plugins/foundation.util.touch.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Quanta CMS
Manage content that works without a database
Author: By
Last change:
Date: 5 years ago
Size: 1,639 bytes
 

Contents

Class file image Download
!function(e){function t(){this.removeEventListener("touchmove",n),this.removeEventListener("touchend",t),r=!1}function n(n){if(e.spotSwipe.preventDefault&&n.preventDefault(),r){var o,i=n.touches[0].pageX,c=(n.touches[0].pageY,s-i);h=(new Date).getTime()-u,Math.abs(c)>=e.spotSwipe.moveThreshold&&h<=e.spotSwipe.timeThreshold&&(o=c>0?"left":"right"),o&&(n.preventDefault(),t.call(this),e(this).trigger("swipe",o).trigger("swipe"+o))}}function o(e){1==e.touches.length&&(s=e.touches[0].pageX,c=e.touches[0].pageY,r=!0,u=(new Date).getTime(),this.addEventListener("touchmove",n,!1),this.addEventListener("touchend",t,!1))}function i(){this.addEventListener&&this.addEventListener("touchstart",o,!1)}e.spotSwipe={version:"1.0.0",enabled:"ontouchstart"in document.documentElement,preventDefault:!1,moveThreshold:75,timeThreshold:200};var s,c,u,h,r=!1;e.event.special.swipe={setup:i},e.each(["left","up","down","right"],function(){e.event.special["swipe"+this]={setup:function(){e(this).on("swipe",e.noop)}}})}(jQuery),!function(e){e.fn.addTouch=function(){this.each(function(n,o){e(o).bind("touchstart touchmove touchend touchcancel",function(){t(event)})});var t=function(e){var t,n=e.changedTouches,o=n[0],i={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup"},s=i[e.type];"MouseEvent"in window&&"function"==typeof window.MouseEvent?t=new window.MouseEvent(s,{bubbles:!0,cancelable:!0,screenX:o.screenX,screenY:o.screenY,clientX:o.clientX,clientY:o.clientY}):(t=document.createEvent("MouseEvent"),t.initMouseEvent(s,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,0,null)),o.target.dispatchEvent(t)}}}(jQuery);