jquery.scrollTo icon indicating copy to clipboard operation
jquery.scrollTo copied to clipboard

How to scroll lists (ul or ol)?

Open mbaas2 opened this issue 2 years ago • 1 comments

(Disclaimer: I must have misunderstood something - but ofc, I don't see what it is. So I apologize in advance for this silly question! 😉)

I am trying to scroll the items of a ul to make a specific li visible - but I'm failing (see this Codepen). What have I done wrong?

mbaas2 avatar Apr 22 '23 17:04 mbaas2

Hi, you should set overflow: auto on the parent to be scrolled. If that works and you can scroll manually, you should be able to scroll programmatically by calling the plugin. Make sure the element is the same that has the scrollbar.

Most like you'll put the ul inside a div, the div has overflow: auto and you call $().scrollTo on it. Your example is trying to scroll the ul, that doesn't have scrollbar. You could also scroll the window if you intended to move the whole screen

flesler avatar Apr 24 '23 14:04 flesler