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

Contents bar on the right hand side doesn't scroll down #1841

Open
1 task done
linkarzu opened this issue Jul 5, 2024 · 3 comments
Open
1 task done

Contents bar on the right hand side doesn't scroll down #1841

linkarzu opened this issue Jul 5, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@linkarzu
Copy link

linkarzu commented Jul 5, 2024

Checklist

How did you create the site?

Generated from chirpy-starter

Describe the bug

I have this blogpost that has a lot of markdown headings, but as you can see on the image below, if I keep scrolling down on the document, the "Contents" section doesn't keep going down, you can see this behaviour on the video below.

Any help would be appreciated!

And by the way, lovely and wonderful theme, I really love it so much, thanks for all the hard work put into it.

https://sharing.linkarzu.com/TbsvzhJpbz0nPQ05Hsg9

Steps To Reproduce

This can be seen in the video

https://sharing.linkarzu.com/TbsvzhJpbz0nPQ05Hsg9

Expected Behavior

The "Contents" section should keep scrolling down as markdown headings scroll down

Environment

❯ ruby -v
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin23]

❯ bundle exec jekyll -v
jekyll 4.3.3

❯ bundle info jekyll-theme-chirpy

Anything else?

No response

@cotes2020
Copy link
Owner

cotes2020 commented Jul 7, 2024

Thank you for reaching out, someone raised this issue years ago, so it seems necessary to improve the table of contents.


Update: It should be this one:

@cotes2020 cotes2020 added the bug Something isn't working label Jul 7, 2024
@linkarzu
Copy link
Author

linkarzu commented Jul 7, 2024

It would be much appreciated, again, thank you very much!

@minyez
Copy link

minyez commented Aug 19, 2024

Hi,

In this issue of tocbot, the author of tocbot gives some hints about making the TOC scrollable. To use it in chirpy, I added the following code to assets/css/jekyll-theme-chirpy.scss

#toc-wrapper {
  overflow-y: scroll;
  height: 75vh;

  /* make the marker of active section visible*/
  ul {
    .is-active-link {
      &::before {
        left: 0px;
      }
    }
  }
}

However, this has a caveat (apart from a slight change in the appearance of the active section marker): if you scroll the body text across headings at the same level, the TOC would not scroll itself accordingly. One can also use selector #toc instead of #toc-wrapper, which solves this issue, but it will mess up the active section marker when you scroll the TOC backwards.

I have no training in web programming so this is after all a hacky workaround. I'm sharing it in hope that someone may come up with a better idea.

@cotes2020 cotes2020 self-assigned this Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants