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

View File

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

View File

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

View File

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