rochal / jQuery-slimScroll

small jQuery plugin that transforms any div into a scrollable area with a nice scrollbar. Demo and more:
http://rocha.la/jQuery-slimScroll
2.23k stars 926 forks source link

Scroll child div also scrolls the window #312

Closed captain-melanie closed 5 years ago

captain-melanie commented 5 years ago

Parent div scrolls by using overflow: auto; child div scrolls by using the slim scroll. How do I prevent scrolling the parent element when the child element scrolls.

The following clip addresses the issue. http://recordit.co/ypbKuf0iaF

Possible solutions that I have tried but not working:

  1. onmouseover and onmouseout events <div onmouseover="document.body.style.overflow='hidden';" onmouseout="document.body.style.overflow='auto';"></div>

  2. e.preventDefaut() on the slim scroll source code, in function slimScroll

davbpad commented 5 years ago

Seems to work in firefox, must be a chrome issue.

davbpad commented 5 years ago

@captain-melanie The jquery in this answer allowed me to stop the scroll event from impacting the parent window: https://stackoverflow.com/a/16324762/6757848