Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had the same problem and didn't found a solution either. But I came up with a hack that seems to work. </p> <p>Since the onMouseUp handler doesn't seem to be able to cancel the click on a link with preventDefault or stopEvent or anything, we need to make the link cancel itself. This can be done by writing an onclick attribute which returns false to the a-tag when the drag begins, and removing it when the drag ends. </p> <p>And since the onDragEnd or onMouseUp handlers are run before the click is interpreted by the browser, we need to do some checking where the drag ends and which link is clicked and so on. If it ends outside the dragged link (we dragged the link so that the cursor isn't on the link anymore), we remove the onclick handler in the onDragEnd; but if it ends where the cursor is on the dragged link (a click would be initiated), we let the onclick-handler remove itself. Complicated enough, right?</p> <p>NOT COMPLETE CODE, but just to show you the idea:</p> <pre><code>// event handler that runs when the drag is initiated function onDragStart (args) { // get the dragged element // do some checking if it's a link etc // store it in global var or smth // write the onclick handler to link element linkElement.writeAttribute('onclick', 'removeClickHandler(this); return false;'); } // run from the onclick handler in the a-tag when the onMouseUp occurs on the link function removeClickHandler (element) { // remove click handler from self element.writeAttribute('onclick', null); } // event handler that runs when the drag ends function onDragEnds (args) { // get the target element // check that it's not the a-tag which we're dragging, // since we want the onclick handler to take care of that case if (targetElement !== linkElement) { // remove the onclick handler linkElement.writeAttribute('onclick', null); } } </code></pre> <p>I hope this gives you an idea of how this can be accomplished. As I said, this is not a complete solution, just explaining the concept. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload