sphinx_rtd_theme icon indicating copy to clipboard operation
sphinx_rtd_theme copied to clipboard

Fixed top navigation bar in mobile

Open umbe1987 opened this issue 8 years ago • 6 comments

Hi everybody, I really like this theme. Would it be possible to always visualize the top menu bar on mobile even after scrolling down the page? I mean, the bar with the title and the three rows which you can tap to visualize the various chapters/sections. Actually, if one needs it on mobile, and he's down the page very far from the top, he has to scroll all the way to the top to find it. Is there an option to have it fixed? Thanks in advance!

umbe1987 avatar Oct 05 '17 08:10 umbe1987

Any thoughts on this?

I am working to improve this, but it's really hard due to my poor knowledge of the code/of programming in general. I just found out from the developer window that the class controlling the aspect of the nav bar on mobile is called wy-nav-top. This has CSS property position:relative. Of course, changing this to position:fixed makes it always visible on top, but it shows up completely "ugly" (it's small and to the left, see image below). I would be happy to contribute with a pull request, but I would need some help.

Thanks again!

immagine

umbe1987 avatar Oct 19 '17 10:10 umbe1987

Just did a quick test of this; would be doable by adding position:fixed; width:100%; top:0 to .wy-nav-top for mobile/tablet breakpoint and setting margin-top: $gutter / 4 + 50px on .wy-nav-content for same breakpoint.

Opinions on adding this option? @Blendify @davidfischer @agjohnson I don't like things eating up my real estate on mobile but if it is a common request, we can do a theme option.

jessetan avatar Jun 18 '18 10:06 jessetan

Thank you so much, I tested your solution and it's exactly what I needed. I don't think it takes much of the display, it's just a very small portion of it and most importantly, it's a must have if you want to navigate to another chapter easily. I would love to see it implemented, but meanwhile I can live with this implementation. Again, thanks for solving this, really appreciate it!

umbe1987 avatar Jun 18 '18 14:06 umbe1987

Any news on this? I am actually using it and it's fine. The only real problem is that when I expand the main navigation panel (wy-nav-side shift), the page scrolls to the top, and, no matter if I was reading (saying) the middle of he page, as soon as I close it I am not where I left before openin the panel, but at the top of the page.

umbe1987 avatar Jan 21 '19 10:01 umbe1987

Another thing I noticed: the top of the page content is hidedn bt the fixed mobile navigation bar. Maybe it has to do with me not having implemented margin-top: $gutter / 4 + 50px to .wy-nav-content as @jessetan suggested, but I can't seem to be able to do it without having the error "invalid css" for $gutter.

Am I missing something?

Anyway, happy to help if you need more info about this issue as I am very interested in this. Thank you!

mobile immagine

desktop immagine

umbe1987 avatar Jan 21 '19 11:01 umbe1987

I would also really like this feature. Some websites manage to hide the nav bar when you scroll down, and as soon as you scroll up just a bit the nav bar is back. It's the best of both worlds, you can easily jump to another chapter while still using all your display when reading.

ShellCode33 avatar Jul 29 '24 00:07 ShellCode33