1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2025-01-18 00:46:47 +01:00

Replaced hidden classes with hidden attributes

This commit is contained in:
squidfunk 2022-06-05 13:58:22 +02:00
parent f1cfe4c07f
commit ce0484e546
11 changed files with 23 additions and 21 deletions

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

View File

@ -34,7 +34,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.ed05e878.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/main.1e7fa3a9.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.cbb835fc.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/palette.cbb835fc.min.css' | url }}">
@ -216,7 +216,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.f9fdf24d.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.f758a944.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 %}

View File

@ -182,8 +182,8 @@ export function mountHeader(
combineLatestWith(header$) combineLatestWith(header$)
) )
.subscribe(([{ active }, { hidden }]) => { .subscribe(([{ active }, { hidden }]) => {
el.classList.toggle("md-header--hidden", hidden)
el.classList.toggle("md-header--shadow", active && !hidden) el.classList.toggle("md-header--shadow", active && !hidden)
el.hidden = hidden
}) })
/* Link to main area */ /* Link to main area */

View File

@ -120,12 +120,12 @@ export function mountTabs(
/* Handle emission */ /* Handle emission */
next({ hidden }) { next({ hidden }) {
el.classList.toggle("md-tabs--hidden", hidden) el.hidden = hidden
}, },
/* Handle complete */ /* Handle complete */
complete() { complete() {
el.classList.remove("md-tabs--hidden") el.hidden = false
} }
}) })

View File

@ -31,6 +31,7 @@
top: 0; top: 0;
inset-inline: 0; inset-inline: 0;
z-index: 4; z-index: 4;
display: block;
color: var(--md-primary-bg-color); color: var(--md-primary-bg-color);
background-color: var(--md-primary-fg-color); background-color: var(--md-primary-fg-color);
// Hack: reduce jitter by adding a transparent box shadow of the same size // Hack: reduce jitter by adding a transparent box shadow of the same size
@ -44,6 +45,14 @@
display: none; display: none;
} }
// Header is hidden
&[hidden] {
transform: translateY(-100%);
transition:
transform 250ms cubic-bezier(0.8, 0, 0.6, 1),
box-shadow 250ms;
}
// Header in shadow state, i.e. shadow is visible // Header in shadow state, i.e. shadow is visible
&--shadow { &--shadow {
box-shadow: box-shadow:
@ -54,14 +63,6 @@
box-shadow 250ms; box-shadow 250ms;
} }
// Header in hidden state, i.e. moved out of sight
&--hidden {
transform: translateY(-100%);
transition:
transform 250ms cubic-bezier(0.8, 0, 0.6, 1),
box-shadow 250ms;
}
// Header wrapper // Header wrapper
&__inner { &__inner {
display: flex; display: flex;

View File

@ -29,6 +29,7 @@
// Must be higher than the z-index of the back-to-top button, or the button // Must be higher than the z-index of the back-to-top button, or the button
// will overlay the navigation tabs bar when scrolling up fast. // will overlay the navigation tabs bar when scrolling up fast.
z-index: 3; z-index: 3;
display: block;
width: 100%; width: 100%;
overflow: auto; overflow: auto;
color: var(--md-primary-bg-color); color: var(--md-primary-bg-color);
@ -46,7 +47,7 @@
} }
// Navigation tabs are hidden // Navigation tabs are hidden
&--hidden { &[hidden] {
pointer-events: none; pointer-events: none;
} }
@ -98,7 +99,7 @@
// Hide tabs upon scrolling - disable transition to minimizes repaints // Hide tabs upon scrolling - disable transition to minimizes repaints
// while scrolling down, while scrolling up seems to be okay // while scrolling down, while scrolling up seems to be okay
.md-tabs.md-tabs--hidden & { .md-tabs[hidden] & {
transform: translateY(50%); transform: translateY(50%);
opacity: 0; opacity: 0;
transition: transition: