mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2025-01-22 03:23:20 +01:00
Fixed instant navigation anchor scoll restoration issue
This commit is contained in:
parent
c6fd95611d
commit
07a434b465
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -249,7 +249,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.60a45f97.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.5090c770.min.js' | url }}"></script>
|
||||
{% for script in config.extra_javascript %}
|
||||
{{ script | script_tag }}
|
||||
{% endfor %}
|
||||
|
@ -366,15 +366,10 @@ export function setupInstantNavigation(
|
||||
// Handle instant navigation events that are triggered by the user clicking
|
||||
// on an anchor link with a hash fragment different from the current one, as
|
||||
// well as from popstate events, which are emitted when the user navigates
|
||||
// back and forth between pages. We use a two-layered subscription to scope
|
||||
// the scroll restoration to the current page, as we don't need to restore
|
||||
// the viewport offset when the user navigates to a different page, as this
|
||||
// is already handled by the previous observable.
|
||||
// back and forth between pages.
|
||||
document$.pipe(
|
||||
switchMap(() => location$),
|
||||
distinctUntilKeyChanged("pathname"),
|
||||
switchMap(() => location$),
|
||||
distinctUntilKeyChanged("hash")
|
||||
distinctUntilKeyChanged("hash"),
|
||||
),
|
||||
|
||||
// Handle instant navigation events that are triggered by the user clicking
|
||||
|
Loading…
x
Reference in New Issue
Block a user