mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-14 19:07:41 +01: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>
|
||||
{% endblock %}
|
||||
{% 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"] %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -326,13 +326,13 @@ export function setupInstantLoading(
|
||||
/* Emit history state change */
|
||||
merge(push$, pop$)
|
||||
.pipe(
|
||||
sample(document$),
|
||||
sample(document$)
|
||||
)
|
||||
.subscribe(({ url, offset = { y: 0 } }) => {
|
||||
.subscribe(({ url, offset }) => {
|
||||
if (url.hash && !offset) {
|
||||
setLocationHash(url.hash)
|
||||
} 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),
|
||||
map(([, state]) => state)
|
||||
)
|
||||
.subscribe(({ offset = { y: 0 } }) => {
|
||||
window.scrollTo(0, offset.y)
|
||||
.subscribe(({ offset }) => {
|
||||
window.scrollTo(0, offset?.y || 0)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user