Hammer js (v 2.0.4) not working well for an img on Desktop IE 11

348 Views Asked by At

I am trying to add swipe and press support to an img using Hammer js version 2.0.4 and I have noticed that it does not work well on Desktop IE11. The gestures are triggered maybe once for every 20 attempts.

Here is a jsfiddle with an example.

http://jsfiddle.net/bhptL6mf/32/

$(function() {

var myImg = document.getElementById("myImg");
var blue = document.getElementById("blue");

var hammerManager = new Hammer.Manager(myImg);
var panRecognizer = new Hammer.Pan({
    threshold: 0,
    pointers: 0
});

hammerManager.add(panRecognizer);

var swipeRecognizer = new Hammer.Swipe({
    threshold: 0,
    velocity: 0.01
});

hammerManager.add(swipeRecognizer).recognizeWith(hammerManager.get('pan'));

hammerManager.on('swipe', function(event) {
    if (event.type == 'swipe') {
        ($(blue).text() === "Swiped") ? $(blue).text(" "): $(blue).text("Swiped");
    }
});

})

Anyone else seeing this issue and know of a workaround? I am also seeing the same issue when gestures are applied to anchors

1

There are 1 best solutions below

0
On

Setting img attribute draggable to false will fix this on IE.

Also noticed a similar issue on Desktop Fire Fox and had to set -moz-user-select to none and prevent dragstart event in addition to setting draggable to false to fix it.