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

Activating the wrong element after layout change #7

Open
ygoe opened this issue Aug 6, 2017 · 2 comments
Open

Activating the wrong element after layout change #7

ygoe opened this issue Aug 6, 2017 · 2 comments

Comments

@ygoe
Copy link

ygoe commented Aug 6, 2017

When scrolling down the page, the first navigation entry is correctly activated, but everything from the second entry on jumps immediately to the following entry once the page is scrolled past the section's top edge. The same happens when scrolling back upwards. It can be easily seen that the second navigation entry is only activated for a very short vertical range.

I noticed that you applied the hash ID to an element that spans the entire section, not just its top, like for example an <h1> element. And that the code registers each section's top and bottom offset, instead of simply the top. But even when I change my document structure to match your demo, that doesn't help.

Looking for solutions in the source code now, as I don't expect any help here, considering the other long-open issues.

@ygoe
Copy link
Author

ygoe commented Aug 6, 2017

Oh, that was tricky. I'm also using the owl carousel, and had initialised that after the scrollspy. So scrollspy would scan the page, remember each tops and bottoms, and then came the carousel and modified the element heights. Once I turned the two around, the scrollspy would work fine.

But one thing remains: If any element on the page changes its height after scrollspy has been initialised, all following scrolling offsets will be wrong (outdated) and that thing essentially fails.

@ygoe ygoe changed the title Activating the wrong element Activating the wrong element after layout change Aug 6, 2017
@ygoe
Copy link
Author

ygoe commented Aug 6, 2017

This has been fixed in 17d2648 in my fork.

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

1 participant