-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make book header always visible #675
base: master
Are you sure you want to change the base?
Conversation
@alex-shpak: Here's a live site where this change is implemented. |
@alex-shpak Is there anything I can do to make this mergeable? This is my second open source contribution, and I've got plenty of enthusiasm. 🚀 I'm happy to communicate if it is something that needs work or you doubt is useful. |
Hi! Sorry for waiting, I haven't made my mind yet if I would like to merge it. I was thinking about some alternative:
Well, I'm still thinking. |
One another note, I tried to not use borders in layout anywhere, adding floating header will add the border between header and the content 🤔 |
Hi, @alex-shpak . Thank you for sharing your thoughts.
I think I can find a CSS only way to close the TOC when the menu is opened, if you prefer. The sticky header doesn't require JavaScript to use; the JavaScript just makes it smoother. Are you concerned about compatibility with user's devices and that's why you don't want any JavaScript?
I don't think it looks bad without a border, and I don't mind making that change if you want it. |
I am using this theme for a book with long chapters. Scrolling to the top of the page on mobile devices to access the table of contents and site navigation is not user friendly. This PR makes the .book-header
sticky
so that the site navigation and table of contents can be accessed from any place on the page. 🥳The header is accessible from partways down the page.
![image](https://private-user-images.githubusercontent.com/21271766/399417399-df761b8b-cc56-4638-9403-b7bffc21850b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg0MzU3NDksIm5iZiI6MTczODQzNTQ0OSwicGF0aCI6Ii8yMTI3MTc2Ni8zOTk0MTczOTktZGY3NjFiOGItY2M1Ni00NjM4LTk0MDMtYjdiZmZjMjE4NTBiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjAxVDE4NDQwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU4ZWQxM2Y2MzIwNDA4NTY1M2E2MDE3ZTA2ZGYyOWMxZjE1ODgyMDY5NDE1YjI4ZGRjZDNiN2E4NWFhMGIyOGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.K-NRZxJi1l5kXc__RWR33XZE54mNK1vf9HSd_JDa0nA)
Notes:
scroll-margin-top
to a value that would guarantee the heading was visible at the top of the viewport.