Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to scroll lists (ul or ol)? #191

Open
mbaas2 opened this issue Apr 22, 2023 · 1 comment
Open

How to scroll lists (ul or ol)? #191

mbaas2 opened this issue Apr 22, 2023 · 1 comment

Comments

@mbaas2
Copy link

mbaas2 commented Apr 22, 2023

(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?

@flesler
Copy link
Owner

flesler commented Apr 24, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants