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 sidebar to middle instead of top. #1161

Merged
merged 4 commits into from
Mar 24, 2020

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Mar 9, 2020

This is a re-submission of #1068. It changes the side bar so that the current page is in the vertical center instead of the top of the window. From the previous PR, I removed the onload event handler since it caused some jumping, and it doesn't seem to be necessary.

@ehuss
Copy link
Contributor Author

ehuss commented Mar 9, 2020

@Dylan-DPC what do you think? I kinda like having it scroll to the middle of the page, where you can see the pages just before and after where you currently are. But the preference is somewhat arbitrary.

I tested on a variety of browsers, and it seems to work well. Some older browsers, like Edge, don't support the "center" property, but do support scrolling, and it scrolls to the top of the page like it does today.

@Dylan-DPC-zz
Copy link

I like the idea. Thanks. Merging! (sorry didn't realise I was pinged :D )

@Dylan-DPC-zz Dylan-DPC-zz merged commit 21a16c9 into rust-lang:master Mar 24, 2020
Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this pull request Aug 30, 2020
* Fix: Scroll sidebar to current active section (rust-lang#1067)

* Clean: Some code related to PR rust-lang#1052

* Change `scrollIntoViewIfNeeded` with `scrollIntoView`

* Don't use onload event for sidebar scroll to reduce flickering.

Co-authored-by: 李鸿章 <poodll@163.com>
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

Successfully merging this pull request may close these issues.

None yet

3 participants