-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Adds option to specify an header height #1045
Adds option to specify an header height #1045
Conversation
When using a template that has a sticky-header, clicking on the sidebar will scroll the page under the header. I added the option `headerHeight` (default = `0`) so that the content div will be scrolled down that amount of pixels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
can you try getting the header height dynamically? using
offsetHeight
may be ! and keeping that as a default instead of0
-
the name
headerHeight
seems like controlling the height of the header but this PR is trying to position the page right ? so I guess we need some better name maybe likeoffsetHeader
? WDYT ? -
You need to update the docs as well.
It's hard to have a one-size-fits-all solution for this. We don't know what is the selector of the header, of which calculate the height. Maybe we can specify the selector and calculate height dinamically?
Docs will be updated accordingly since this PR seems interesting. |
By default the navbar will be at
offset with navbar's height !
It would be better if you can add the docs in this PR itself. it help to others who refers the changelog and PR accrodingly. |
Well I am trying to fix the error when a header with <div id="navbar" style="position:fixed; top:0; height:90px;">
...
</div>
<div id="app"></div>
<script>
window.$docsify = {
name: 'Foobar',
logo: 'img/foobar.svg',
repo: 'https://github.com/foo/bar',
loadSidebar: '_sidebar',
}
</script>
that is what I meant, sorry :) |
Go ahead ! this seems like a nice enhancement. Just let me know when this is ready for fresh review |
I will test it locally soon ! |
I was having the same issue and could not find the updated documentation. So this will work: |
When using a template that has a sticky-header, clicking on the sidebar will
scroll the page under the header.
I added the option
headerHeight
(default =0
) so that the content div willbe scrolled down that amount of pixels.
Summary
What kind of change does this PR introduce? (check at least one)
Before
After
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)You have tested in the following browsers: (Providing a detailed version will be better.)
If adding a new feature, the PR's description includes:
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information:
lib
directory.