Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling Drag in Hammer.js

Tags:

hammer.js

drag

I am trying to drag a div using Hammer.js

var revcircle = document.getElementById('rev-circle');
var rc = new Hammer(revcircle);

rc.on("drag", function(event) {
event.preventDefault();
    alert('dragged');

});

rev-circle is my div id.

<div class="mini-circles1" id="rev-circle" draggable="true">
     <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. <br/><br/> John Campbell<br>President and CEO<br> Toranto Waterfront Revitalization Corportation</p>

</div>

I have included jquery ui also. But the it is not recognizing drag functionality. tap swipe etc are working fine. I am using hammer version v2.0.4.

Am I missing anything here???

like image 489
vamsi Avatar asked Dec 05 '25 13:12

vamsi


1 Answers

In Hammer.js v2.0.x, it seems its "pan" instead of "drag".

like image 199
Gagan Avatar answered Dec 08 '25 03:12

Gagan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!