How to make HTML5 drag and drop element scroll page

Apparently, they could not add the ability to scroll the page while dragging the item. For my purposes, I need to scroll the page. I know that you can drag and drop in jQuery, but I don't want to switch to this because I already have many other things that are based on using the HTML5 implementation.

I realized that you can get the value of event.pageY while scrolling, and if it is close to the bottom of the page, scroll down and if it is close to the top, scroll up. I'm having trouble retrieving event.pageY values ​​in my drag function.

Here is my fiddle . Does anyone have any ideas?

+4
source share

Source: https://habr.com/ru/post/1502717/


All Articles