camohub / jquery-sortable-lists

jQuery plugin to sorting lists also the tree structures.
MIT License
209 stars 60 forks source link

Issue with scrolling ancestors other than the body or html elements #62

Open lucaslm opened 3 years ago

lucaslm commented 3 years ago

Greetings @camohub!

Firstly, thanks for the awesome plugin. Unfortunatelly I found an issue with it, but I believe it can be addressed. When dragging an item to the edge of the screen, it automatically scrolls the window to continuing moving the item up or down. This works mostly fine, but I noticed that when one or more ancestors of the list element also have scroll bars of their own, this becomes an issue. Here are some examples I have on my forking of the project:

Fortunatelly, the following pull request solves this issue. I've tested it on many browsers and it seems to work. I've commited from the dev branch, which I think is the one you use for bug fixing and improvements

https://github.com/camohub/jquery-sortable-lists/pull/61

camohub commented 3 years ago

Sorry for the late response. Thank you. I am going to look at it.

erikbakker commented 3 years ago

Same problem here, lucaslm solution works fine for me, thanks.

camohub commented 3 years ago

@erikbakker how looks your code? Where are the scroll elements on the page? @lucaslm wrote solution which is very ineffective as a code. I has to write it to be efficient with huge lists. Also there are other problems if the list opens while dragging. ..

So show me the code and mark the elements which should be scrollable.

erikbakker commented 3 years ago

I only have 1 div which is scrollable, it is inside a div with 100vh and an overflow hidden. The scollable div containts the scrollable listst. Thats all

camohub commented 3 years ago

What about jsfiddle? My imagination is not on the required level :) Think about the setting which will setup scrollable elment directly. What do you think about it?