Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop drag event during click a link

i have drag event over a div.image attached. enter image description here

when i mouse down on div the drag event start.for this i include nestable.js plugin.i want to stop drag event of div during click on links of div .i am using js and html file from link: Nestable

Please give the solution,how can i do it.

like image 444
Rahul Avatar asked Apr 26 '13 05:04

Rahul


2 Answers

To ignore handling on click, add "dd-nodrag" class to element.

like image 92
mrcyborg Avatar answered Sep 27 '22 17:09

mrcyborg


author has a problem with nestable plugin. there is some better way to solve the problem of link click that is placed in the nestable container:

$(".dd a").on("mousedown", function(event) { // mousedown prevent nestable click
    event.preventDefault();
    return false;
});

$(".dd a").on("click", function(event) { // click event
    event.preventDefault();
    window.location = $(this).attr("href");
    return false;
});

.dd - default nestable container class, change it if you need

like image 40
Viktor Sanzharevskyy Avatar answered Sep 27 '22 18:09

Viktor Sanzharevskyy