mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Merge branch 'master' into greenkeeper/babel-preset-es2015-6.22.0
This commit is contained in:
commit
4186b7b7f8
File diff suppressed because one or more lines are too long
@ -31,7 +31,7 @@
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block libs %}
|
||||
<script src="{{ base_url }}/assets/javascripts/modernizr-0d3dc73294.js"></script>
|
||||
<script src="{{ base_url }}/assets/javascripts/modernizr-facb31f4a3.js"></script>
|
||||
{% endblock %}
|
||||
{% block fonts %}
|
||||
{% if config.extra.font != "none" %}
|
||||
@ -124,7 +124,7 @@
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% block scripts %}
|
||||
<script src="{{ base_url }}/assets/javascripts/application-16f434a21a.js"></script>
|
||||
<script src="{{ base_url }}/assets/javascripts/application-eb5283d5b7.js"></script>
|
||||
<script>var config={url:{base:"{{ base_url }}"}},app=new Application(config);app.initialize()</script>
|
||||
{% for path in extra_javascript %}
|
||||
<script src="{{ path }}"></script>
|
||||
|
@ -45,7 +45,7 @@
|
||||
"css-mqpacker": "^5.0.1",
|
||||
"custom-event-polyfill": "^0.3.0",
|
||||
"del": "^2.2.2",
|
||||
"eslint": "^3.13.1",
|
||||
"eslint": "^3.14.0",
|
||||
"eslint-plugin-mocha": "^4.8.0",
|
||||
"fastclick": "^1.0.6",
|
||||
"git-hooks": "^1.1.7",
|
||||
|
@ -41,6 +41,9 @@ export default class Blur {
|
||||
this.index_ = 0
|
||||
this.offset_ = window.pageYOffset
|
||||
|
||||
/* Necessary state to correctly reset the index */
|
||||
this.dir_ = 0
|
||||
|
||||
/* Index anchor node offsets for fast lookup */
|
||||
this.anchors_ = [].map.call(this.els_, el => {
|
||||
return document.getElementById(el.hash.substring(1))
|
||||
@ -62,6 +65,14 @@ export default class Blur {
|
||||
*/
|
||||
update() {
|
||||
const offset = window.pageYOffset
|
||||
const dir = Math.sign(this.offset_ - offset)
|
||||
|
||||
/* Hack: reset index if direction changed, to catch very fast scrolling,
|
||||
because otherwise we would have to register a timer and that sucks */
|
||||
if (this.dir_ !== dir)
|
||||
this.index_ = dir < 0
|
||||
? this.index_ = 0
|
||||
: this.index_ = this.els_.length - 1
|
||||
|
||||
/* Exit when there are no anchors */
|
||||
if (this.anchors_.length === 0)
|
||||
@ -92,8 +103,9 @@ export default class Blur {
|
||||
}
|
||||
}
|
||||
|
||||
/* Remember current offset for next iteration */
|
||||
/* Remember current offset and direction for next iteration */
|
||||
this.offset_ = offset
|
||||
this.dir_ = dir
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user