Jump to content
Search Community

Nsmith94

Premium
  • Posts

    1
  • Joined

  • Last visited

About Nsmith94

Nsmith94's Achievements

  1. I am by far a GSAP novice, but I have worked on a few kiosk interactives that clients have requested that draggable components work with multitouch. I am not sure if this will interfere with any other aspects of the gsap.draggable, but I have had some luck with using this little snippet I found somewhere a while back, sorry I can't find the original link. It allows the draggable to work normally even if additional touches are added during the drag. function initDragContainer(){ let dragCont = document.getElementByID('dragCont'); let dragContParent = document.getElementByID('dragCont'); let yBoundMin = -(.clientHeight-svgContBox.clientHeight); Draggable.create(svgCont, { type:'y', bounds:{minY:yBoundMin,maxY:0}, inertia: true, zIndexBoost: false, edgeResistance:.75, }) function ignoreEvent(e){ e.preventDefault(); e.stopImmediatePropagation(); if(e.preventManipulation){ e.preventManipulation(); } return false; } dragCont.addEventListener('touchstart',ignoreEvent,false); dragCont.addEventListener('touchend',ignoreEvent,false);
×
×
  • Create New...