Jump to content


My onclick event disable draggable

Recommended Posts

I need to have my element draggable but I also need to find out where a user clicks on it. Problem with this code is that it disables the drag. Any ideas how i can get the element draggable and in the same time in someway find out where a user clicked on the element?


My code which fires and outputs the position of the click to the console but it disables draggable:


var myDiv = document.getElementById(dynamicdividname);
myDiv.onclick=function() {
         var xx = event.clientX;
         var yy = event.clientY;
         console.log("X:"+xx+" Y:"+yy);
Thanks for any answers in advance..!!
Link to comment
Share on other sites

By default, Draggable assumes that clickable elements (like ones that have an onclick defined) shouldn't be draggable. You can easily change this by adding dragClickables:true, like:

Draggable.create("#"+dynamicdividname, {dragClickables:true});
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.