rstudio / bookdown

Authoring Books and Technical Documents with R Markdown
https://pkgs.rstudio.com/bookdown/
GNU General Public License v3.0
3.79k stars 1.27k forks source link

[FR] make the bs4_book sticky menu sticky on mobile #1380

Open jtbayly opened 2 years ago

jtbayly commented 2 years ago

From the bookdown guide about bs4_book: "Thoughtful typography to make the contents as easy as possible to read, regardless of the size of your device. A sticky header gets out of your way when reading, but is easily accessible if you need it.”

The bs4_book menu is not sticky on small screens. (This might be a bug report, given what the documentation says?)

If I'm reading in the middle of a long page, and I want to go to another part of the book, I have no obvious way on the screen to do so. I have to remember that there was a hamburger menu at the top of the page, and I have to know what it does already. It would be really handy to have a sticky menu on mobile, especially when you are reading a long page.

In particular, "sticky" implies to me that the hamburger menu for the TOC floats on the screen, or if it disappears, it shows back up the moment I start scrolling back up toward the top of the page.

cderv commented 2 years ago

In particular, "sticky" implies to me that the hamburger menu for the TOC floats on the screen, or if it disappears, it shows back up the moment I start scrolling back up toward the top of the page.

I would love to have that ! I am not an expert in mobile friendly development, so I don't know an easy way to do this. Maybe Bootstrap has component to help us with that.

So it would require a bit of learning about CSS and web development for mobile friendly website.

If anyone wants to help, please do !

ax-jkriese commented 2 years ago

Hey there @cderv, @jtbayly asked if I could lend a hand to help out with making the menu sticky, here's a PR on a fork that includes that update: https://github.com/rstudio/bookdown/pull/1385

Let me know what you think!

cderv commented 2 years ago

Awesome @ax-jkriese ! Thank you. I'll look at that shortly. Really appreciating the help

jtbayly commented 2 years ago

Wow, this looks great, @ax-jkriese. Just what I was hoping for. Thanks again.