Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@neodigm 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