I want to make it so swiping over an image will take a user to the previous or next image, depending on the direction of the swipe. That part works great, BUT it removes the ability to zoom in on the image. According to this answer the solution is to enable touchAction: 'auto'
, but that breaks hammer.js entirely, preventing it from working for swipe at all.
Code:
<script src="../js/hammer.min.js"></script>
<script>
$('.imagecontainer').each(function(){
var options = {
touchAction: 'auto',
};
var mc = new Hammer(this, options);
mc.on("swipeleft", function() {
navTo('jsnavnext');
return false;
});
mc.on("swiperight", function() {
navTo('jsnavprev');
return false;
});
});
</script>
I can get pinch-zoom to work in the least user-friendly way possible with touchAction: 'pan-y'
(basically requires the user to make a wacky circle motion), but that's not...great. Ideally I'd like hammer.js to ONLY add swipe navigation and not touch any other default behaviour.