mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed anchor navigation when using instant loading
This commit is contained in:
parent
b6ca0a1053
commit
ebcd000fdc
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -213,7 +213,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.e0abf5b0.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.33f85c42.min.js' | url }}"></script>
|
||||||
{% for path in config["extra_javascript"] %}
|
{% for path in config["extra_javascript"] %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -326,13 +326,13 @@ export function setupInstantLoading(
|
|||||||
/* Emit history state change */
|
/* Emit history state change */
|
||||||
merge(push$, pop$)
|
merge(push$, pop$)
|
||||||
.pipe(
|
.pipe(
|
||||||
sample(document$),
|
sample(document$)
|
||||||
)
|
)
|
||||||
.subscribe(({ url, offset = { y: 0 } }) => {
|
.subscribe(({ url, offset }) => {
|
||||||
if (url.hash && !offset) {
|
if (url.hash && !offset) {
|
||||||
setLocationHash(url.hash)
|
setLocationHash(url.hash)
|
||||||
} else {
|
} else {
|
||||||
window.scrollTo(0, offset.y)
|
window.scrollTo(0, offset?.y || 0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ export function setupInstantLoading(
|
|||||||
filter(([a, b]) => a.url.pathname === b.url.pathname),
|
filter(([a, b]) => a.url.pathname === b.url.pathname),
|
||||||
map(([, state]) => state)
|
map(([, state]) => state)
|
||||||
)
|
)
|
||||||
.subscribe(({ offset = { y: 0 } }) => {
|
.subscribe(({ offset }) => {
|
||||||
window.scrollTo(0, offset.y)
|
window.scrollTo(0, offset?.y || 0)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user