docsifyjs / docsifyjs/docsify

option to specify screen width at which point navbar is merged into sidebar

Open
#1,272 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
31.5k
Forks
5.8k
Avg merge
9d 8h
Merged PRs (30d)
2

Description

## Feature request

The existing `mergeSidebar` option is nifty: it allows you to merge the navbar into the sidebar for smaller screens, otherwise it won't look right.

However, the navbar can still look funky at certain sizes that are bigger than the mobile size (768px and up).

For example:

![bad-navbar](https://user-images.githubusercontent.com/297678/86547858-30002b00-beef-11ea-879f-4b63241c5682.gif)

#### What problem does this feature solve?

An option would prevent cases when the navbar doesn't fit well at the top, even if the screen width is bigger than mobile.

#### What does the proposed API look like?

A new option (maybe something like `mergeNavbarAtWidth`) would allow us to specify a width at which the navbar should be merged.

#### How should this be implemented in your opinion?

We need to update the `mergeNavbar` feature to operate at runtime any time the width of the Docsify app is updated, instead of only at the beginning. Then, we need to merge the navbar when the width is below the specified size in the `mergeNavbarAtWidth` option.

We need to make this operate on resizes because people may resize their window.

At the moment, the merging only happens once initially, but if we resize our window from desktop size to mobile size then the navbar will not be merged. In this video I shrink my window and the menu does not get merged:

![no-merge](https://user-images.githubusercontent.com/297678/86548064-f4199580-beef-11ea-80ef-2d590cfcb56e.gif)

If you visit the site on your mobile phone (https://lume.io/docs), or do a refresh when your desktop browser window is on mobile size, then you will see the menu inside of the sidebar like the following:

![mobile-menu](https://user-images.githubusercontent.com/297678/86548154-3e027b80-bef0-11ea-9f03-e8dfad5a24a7.png)

#### Are you willing to work on this yourself?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.