conflict between hammer.js and jquery

526 views Asked by At

I am trying to create a swipe effect with help of hammer.js but it seems it creating a issue with jquery file

jquery code with hammer

       $( document ).ready(function() {
    console.log( "ready!" );

        $(".swiper").hammer().on("swipeleft", function(event) {
    //callback

     console.log( "swipeleft!" );

});
});

html code

error

enter image description here

1

There are 1 answers

5
Nitesh On

I am assuming you have already included hammer.js and jQuery in your project. You can try this now.

var hammer = new Hammer($(".swiper")[0]);
hammer.on("swipeLeft", function(evt){
console.log("Swipe Left");
});