mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-28 01:10:58 +01:00
Fixed instant loading jumping back to the top
This commit is contained in:
parent
329d26d34a
commit
f480bb28a9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -240,7 +240,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.56494524.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.16752b02.min.js' | url }}"></script>
|
||||
{% for path in config.extra_javascript %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -206,6 +206,7 @@ export function setupInstantLoading(
|
||||
sample(response$)
|
||||
)
|
||||
.subscribe(({ url }) => {
|
||||
console.log("history.pushState")
|
||||
history.pushState({}, "", `${url}`)
|
||||
})
|
||||
|
||||
@ -288,7 +289,7 @@ export function setupInstantLoading(
|
||||
sample(document$)
|
||||
)
|
||||
.subscribe(({ url, offset }) => {
|
||||
if (url.hash && !offset) {
|
||||
if (url.hash && !offset?.y) {
|
||||
setLocationHash(url.hash)
|
||||
} else {
|
||||
window.scrollTo(0, offset?.y || 0)
|
||||
|
Loading…
Reference in New Issue
Block a user