-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Scrolling tocbot and scrolling page #275
Comments
Ok. I found this: #114 So I tried and here is the code that is not working for me:
But if I change UpdateVisibleToc() to the following, it works but not smoothly as it should:
I am not sure what I am doing wrong so here is the gif showing what's happening... Here is the html code
The above function is set to be called after DOM is ready (page loaded) as well as on scrolling. |
hmm, this functionality should be built into tocbot itself since the above PR you mentioned merged. If you make the height of the window small and test here it should work and scroll the toc: Can you share a link / example that reproduces this so we can try to help? Maybe try using behavior: scroll-smooth css would help on that container? |
Hi @tscanlin - thank you. I tried with
I also tried reducing the height of the window and scrolling but still the same. Eagerly waiting for your response! Thank you. :-) |
Hey, thanks for sharing the example! Can you try adding the following properties to
If you want the toc to be a different height you could do something like Hope that helps! Let me know if you are still running into issues. |
Hi Tim,
You are a magician! 😊.
And that means my issue is resolved 😊 . It works flawlessly now. THANK YOU SO MUCH!
One use case that I need to handle now is that scrolling the tocbot output manually should not scroll the content (.js-toc-content).
Before I start working on it – is at also assumed to happen already 😊 ?
…-Amit
|
Glad I've bee helpful! :) Though I'm not sure what you mean by "scrolling the tocbot output manually should not scroll the content" Could you share a video perhaps to help explain? |
@tscanlin: Thanks for asking. I fixed it. What I meant was that if I manually scroll only the tocbot container, the page (js-toc-content) should not scroll with it. I managed to do it by checking when mouse enters the tocbot div area and at that time, stop content from scrolling. And when it comes out, I enabled content scrolling. Thanks again!! |
Hi @tscanlin ,
On long pages, the tocbot output overflows so one needs to scroll down the page to see it. So I added scrollbar to the tocbot output. Now, when the page is too long and tocbot has scrollbars visible, the page scrolling highlights the headings fine but if it happens to be in the tocbots overflowing content, it stays hidden untill I scroll the tocbot div.
I tried calling the following from console in browser and it works as expected to show the right heading in tocbot but wherever I put in in code - in
window.onscroll
or after page ready or aftertocbot.init
- it doesnt work.In a way, I want the above to happen everytime the
.is-active-link
class moves up or down.Is this expected behavior because both content container and tocbot container are scrolling separately? In anycase, is there a way out of this?
-Amit
The text was updated successfully, but these errors were encountered: