Fix initialization logic of sidebar

This commit is contained in:
squidfunk 2016-12-28 12:24:42 +01:00
parent 84dd88af69
commit 96ae06f25c
5 changed files with 6 additions and 11 deletions

View File

@ -86,9 +86,7 @@
<div class="md-content">
<article class="md-content__inner md-typeset">
{% if config.edit_uri %}
<a href="{{ page.edit_url }}" title="Edit this page" class="md-icon md-content__edit">
edit
</a>
<a href="{{ page.edit_url }}" title="Edit this page" class="md-icon md-content__edit">edit</a>
{% endif %}
{% block content %}
{% if not "\x3ch1 id=" in page.content %}
@ -111,7 +109,7 @@
<script src="https://cdn.mathjax.org/{{ path }}"></script>
{% endif %}
{% endfor %}
<script src="{{ base_url }}/assets/javascripts/application-7d27d432c4.js"></script>
<script src="{{ base_url }}/assets/javascripts/application-e4e6991dc0.js"></script>
<script>
/* Configuration for application */
var config = {

View File

@ -27,7 +27,6 @@ site_url: http://squidfunk.github.io/mkdocs-material/
# Repository
repo_name: squidfunk/mkdocs-material
repo_url: https://github.com/squidfunk/mkdocs-material
edit_uri: edit/rework/docs/
# Copyright
copyright: 'Copyright &copy 2016 Martin Donath'

View File

@ -37,9 +37,8 @@ export default class Position {
? document.querySelector(el)
: el
/* Initialize parent container, top offset and current height */
/* Initialize parent container and current height */
this.parent_ = this.el_.parentNode
this.offset_ = this.el_.offsetTop - this.parent_.offsetTop
this.height_ = 0
}
@ -47,6 +46,7 @@ export default class Position {
* Initialize sidebar state
*/
setup() {
this.offset_ = this.el_.offsetTop - this.parent_.offsetTop
this.update()
}

View File

@ -168,9 +168,7 @@
<!-- Edit button, if URL was defined -->
{% if config.edit_uri %}
<a href="{{ page.edit_url }}" title="Edit this page"
class="md-icon md-content__edit">
edit
</a>
class="md-icon md-content__edit">edit</a>
{% endif %}
<!-- Block: content -->