Is there a way to enable my site to drag and drop a DOM element using the right mouse button? According to this MDN link, an event draghas a property buttonsthat is 1 for left click, 2 for right click, and 3 for both. So I wrote something really simple for testing:
data:text/html, <div id="draggable" draggable="true" ondrag="console.log(event.buttons)" oncontextmenu="return false">Drag This</div>
When I drag this div with the left button, it prints 1 on the console (several times when the event is ondragconstantly triggered when the drag is in progress). When I try to drag it with the right button, nothing happens - I can not drag it. When I start dragging it with the left button, hold the left and right buttons, it prints 3. If I do this, then release the left button and hold it only to the right, then the tags immediately end.
Can I drag and drop items using the right mouse button?
(I use the latest version of Chrome, if that matters.)
source
share