mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed back-to-top button when using instant loading
This commit is contained in:
parent
a7c1d06470
commit
9752ad2630
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -40,7 +40,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.7bf56d0a.min.css' | url }}">
|
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.c4a75a56.min.css' | url }}">
|
||||||
{% if config.theme.palette %}
|
{% if config.theme.palette %}
|
||||||
{% set palette = config.theme.palette %}
|
{% set palette = config.theme.palette %}
|
||||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.a0c5b2b5.min.css' | url }}">
|
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.a0c5b2b5.min.css' | url }}">
|
||||||
@ -183,10 +183,10 @@
|
|||||||
{% include "partials/javascripts/content.html" %}
|
{% include "partials/javascripts/content.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% if "navigation.top" in features %}
|
{% if "navigation.top" in features %}
|
||||||
<a href="#" class="md-top md-icon" data-md-component="top" hidden>
|
<button type="button" class="md-top md-icon" data-md-component="top" hidden>
|
||||||
{% include ".icons/material/arrow-up.svg" %}
|
{% include ".icons/material/arrow-up.svg" %}
|
||||||
{{ lang.t("top") }}
|
{{ lang.t("top") }}
|
||||||
</a>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</main>
|
</main>
|
||||||
{% block footer %}
|
{% block footer %}
|
||||||
@ -240,7 +240,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.fc8c2696.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.efa0ade1.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 %}
|
||||||
|
@ -29,6 +29,7 @@ import {
|
|||||||
distinctUntilKeyChanged,
|
distinctUntilKeyChanged,
|
||||||
endWith,
|
endWith,
|
||||||
finalize,
|
finalize,
|
||||||
|
fromEvent,
|
||||||
ignoreElements,
|
ignoreElements,
|
||||||
map,
|
map,
|
||||||
repeat,
|
repeat,
|
||||||
@ -166,6 +167,13 @@ export function mountBackToTop(
|
|||||||
el.style.top = `${height + 16}px`
|
el.style.top = `${height + 16}px`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/* Go back to top */
|
||||||
|
fromEvent(el, "click")
|
||||||
|
.subscribe(ev => {
|
||||||
|
ev.preventDefault()
|
||||||
|
window.scrollTo({ top: 0 })
|
||||||
|
})
|
||||||
|
|
||||||
/* Create and return component */
|
/* Create and return component */
|
||||||
return watchBackToTop(el, { viewport$, main$, target$ })
|
return watchBackToTop(el, { viewport$, main$, target$ })
|
||||||
.pipe(
|
.pipe(
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
margin-inline-start: 50%;
|
margin-inline-start: 50%;
|
||||||
font-size: px2rem(14px);
|
font-size: px2rem(14px);
|
||||||
color: var(--md-default-fg-color--light);
|
color: var(--md-default-fg-color--light);
|
||||||
|
cursor: pointer;
|
||||||
background-color: var(--md-default-bg-color);
|
background-color: var(--md-default-bg-color);
|
||||||
border-radius: px2rem(32px);
|
border-radius: px2rem(32px);
|
||||||
outline: none;
|
outline: none;
|
||||||
|
@ -334,15 +334,15 @@
|
|||||||
|
|
||||||
<!-- Back-to-top button -->
|
<!-- Back-to-top button -->
|
||||||
{% if "navigation.top" in features %}
|
{% if "navigation.top" in features %}
|
||||||
<a
|
<button
|
||||||
href="#"
|
type="button"
|
||||||
class="md-top md-icon"
|
class="md-top md-icon"
|
||||||
data-md-component="top"
|
data-md-component="top"
|
||||||
hidden
|
hidden
|
||||||
>
|
>
|
||||||
{% include ".icons/material/arrow-up.svg" %}
|
{% include ".icons/material/arrow-up.svg" %}
|
||||||
{{ lang.t("top") }}
|
{{ lang.t("top") }}
|
||||||
</a>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user