Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable animation for drag and drop Chrome/Safari

http://www.html5rocks.com/en/tutorials/dnd/basics/

In the example here (scroll to the bottom and try the last example), when you drag out the element and don't drop it anywhere, it is positioned back to its default place and there is an animation for positioning to its default place (Chrome/Safari). I would like to disable that animation.

Is there some sort of special property for webkit, that will allow me to do this?

like image 306
puppeteer701 Avatar asked Aug 25 '15 13:08

puppeteer701


People also ask

How do I turn off animations in Google Chrome?

To access the settings, click the Extensions icon in your Chrome Toolbar (see screenshot below) and then click the Animation Policy icon (the one that looks like a lightening bolt). Finally, select either Allow animated images, but only once or Disable all image animation based on your specific needs.


1 Answers

Found answer here and it works in my case https://stackoverflow.com/a/51697038/1770586

In order to prevent the animation, you need the drop event to fire. For the drop event to fire, you need to call preventDefault() in the handler for dragover.

document.addEventListener('dragover', function(e) { e.preventDefault() })

like image 138
jaromudr Avatar answered Oct 08 '22 04:10

jaromudr