Skip to content

Instantly share code, notes, and snippets.

@neodigm
Created January 21, 2021 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neodigm/ad911a30dd142e741b40dfe6aa946e5b to your computer and use it in GitHub Desktop.
Save neodigm/ad911a30dd142e741b40dfe6aa946e5b to your computer and use it in GitHub Desktop.
var doTwoTouch = (function( _d, _q){ // Capture Pinch attempt on carousel
var eCntr, aEv=[];
setTimeout(function(){
if( oTopmenu && oTopmenu.isMobile() ) doTwoTouch.init();
}, 2800);
return {
"init": function(){
eCntr = _d.querySelector( _q[0] );
if( eCntr ){
eCntr.addEventListener("pointerdown", doTwoTouch.twoTouchDown );
eCntr.addEventListener("pointerup", doTwoTouch.twoTouchUp );
eCntr.addEventListener("pointercancel", doTwoTouch.twoTouchUp );
eCntr.addEventListener("pointerout", doTwoTouch.twoTouchUp );
eCntr.addEventListener("pointerleave", doTwoTouch.twoTouchUp );
}
},
"twoTouchDown": function( ev ){
if( eCntr ){
aEv.push( ev );
if( aEv.length > 1) vltdc_productdetail.doTapToZoom();
}
},
"twoTouchUp": function( ev ){
if( eCntr ){
aEv = aEv.filter(function( _ev ){
return ( _ev.pointerId !== ev.pointerId ); });
}
}
};
})( document, ["#js-flick__hero--id"] );
@neodigm
Copy link
Author

neodigm commented Jan 21, 2021

Determine if the user attempted to pinch zoom on a carousel image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment