5 ms·
Too many custom scrollbar projects (including this one) make the mistake of overriding everything helpful the browser does for you and then imperfectly reimplem
by adamesque 15y ago
Too many custom scrollbar projects (including this one) make the mistake of overriding everything helpful the browser does for you and then imperfectly reimplementing it.
The best technical approach is to make the scrollable element naturally scrollable with overflow: auto, and then put it inside a viewport element (overflow: hidden) narrow enough to cut off the scrollbar (there are plugins that can help you figure out exactly how wide the host's OS's scrollbars are).
Then, you're free to listen for scroll events and overlay your own custom scroller UI.
- jamesflorentino 15y agoThanks! That seems pretty useful. Will include that in my next commit.
- sil3ntmac 15y agoI implemented something similar here: https://github.com/joevennix/jScrollie https://github.com/joevennix/jScrollie I agree that it is best to let the browser handle the scrolling mechanics. Then you simply hide the original scrollbar by having an embedded div hold the content with a width thats about 40px or so bigger than the outer, fixed width div ( and overflow: scroll-y ).
- kyle81 15y agowow, it looks like a rip off of an older project - http://rocha.la/jQuery-slimScroll http://rocha.la/jQuery-slimScroll