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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll Parent is inside another Parent #11

Open
johnygold opened this issue Jan 21, 2013 · 1 comment
Open

Scroll Parent is inside another Parent #11

johnygold opened this issue Jan 21, 2013 · 1 comment

Comments

@johnygold
Copy link

I have three DIV's. Scrollintoview is used to scroll to DIV 3, that is inside DIV 2. This works. However, DIV 2 is inside DIV 1, and the part where DIV 3 is visible is not into view from the viewpoint of DIV 1. So I have to scroll down DIV 1 (which is the actually the body of my document) to get DIV 3 visible. Is there a way to also scroll the DIV 1 automatically so DIV 3 becomes visible?

@litera
Copy link
Owner

litera commented Jan 21, 2013

First of all if you have scrollable inside scrollable you may have a usability problem. That's why I didn't implement nested plugin. First of all it would be much more complex to make (under particular circumstances) and second of all I would rather encourage developers to rethink their UI.

but apart from this and depending on your particular situation, you may call scrollintoview twice:

  1. on div2 which scrolls it into view within div1
  2. and then on div3 which scrolls it into view within div2

This will work if div2 is smaller in size than div1 otherwise some part of the scrolled-in element may still be beyond visible viewport and scrolling the third element within that one may still render it beyond visible part.

As mentioned: rethink your UI because even without any automated scrolling users are likely frustrated by this double deep scrolling which makes it pretty hard to find what they're looking for.

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