bookdown icon indicating copy to clipboard operation
bookdown copied to clipboard

[FR] make the bs4_book sticky menu sticky on mobile

Open jtbayly opened this issue 1 year ago • 4 comments

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.

jtbayly avatar Sep 01 '22 20:09 jtbayly

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 !

cderv avatar Sep 02 '22 10:09 cderv

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!

ax-jkriese avatar Sep 17 '22 20:09 ax-jkriese

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

cderv avatar Sep 19 '22 09:09 cderv

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

jtbayly avatar Sep 20 '22 00:09 jtbayly