Last active
October 29, 2021 10:17
-
-
Save bakura10/b0647ef412eb7757fa6f0d2c74c1f145 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var touchingCarousel = false, | |
touchStartCoords; | |
document.body.addEventListener('touchstart', function(e) { | |
if (e.target.closest('.flickity-slider')) { | |
touchingCarousel = true; | |
} else { | |
touchingCarousel = false; | |
return; | |
} | |
touchStartCoords = { | |
x: e.touches[0].pageX, | |
y: e.touches[0].pageY | |
} | |
}); | |
document.body.addEventListener('touchmove', function(e) { | |
if (!(touchingCarousel && e.cancelable)) { | |
return; | |
} | |
var moveVector = { | |
x: e.touches[0].pageX - touchStartCoords.x, | |
y: e.touches[0].pageY - touchStartCoords.y | |
}; | |
if (Math.abs(moveVector.x) > 7) | |
e.preventDefault() | |
}, {passive: false}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HI @bakura10 : iOS 15 touch scrolll is not working. if you have fix. please help me to resolve the iOS 15 scroll issue