Improved touch-friendliness of version selector on mobile

This commit is contained in:
squidfunk 2021-05-30 13:31:07 +02:00
parent 6ce586c970
commit bdbd4af29d
5 changed files with 30 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,7 +39,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.66ec5ba4.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/main.875de78c.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.f1a3b89f.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/palette.f1a3b89f.min.css' | url }}">

View File

@ -25,7 +25,7 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Show repository facts // Show repository facts
@keyframes md-source__facts--done { @keyframes facts {
0% { 0% {
height: 0; height: 0;
} }
@ -36,7 +36,7 @@
} }
// Show repository fact // Show repository fact
@keyframes md-source__fact--done { @keyframes fact {
0% { 0% {
transform: translateY(100%); transform: translateY(100%);
opacity: 0; opacity: 0;
@ -137,7 +137,7 @@
// Show after the data was loaded // Show after the data was loaded
[data-md-state="done"] & { [data-md-state="done"] & {
animation: md-source__facts--done 250ms ease-in; animation: facts 250ms ease-in;
} }
} }
@ -147,7 +147,7 @@
// Show after the data was loaded // Show after the data was loaded
[data-md-state="done"] & { [data-md-state="done"] & {
animation: md-source__fact--done 400ms ease-out; animation: fact 400ms ease-out;
} }
// Repository fact icon // Repository fact icon

View File

@ -20,6 +20,17 @@
/// DEALINGS /// DEALINGS
//// ////
// ----------------------------------------------------------------------------
// Keyframes
// ----------------------------------------------------------------------------
// See https://github.com/squidfunk/mkdocs-material/issues/2429
@keyframes hoverfix {
0% {
pointer-events: none;
}
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Rules // Rules
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -107,6 +118,20 @@
max-height 0ms, max-height 0ms,
opacity 250ms; opacity 250ms;
} }
// Fix hover on touch devices
@media (pointer: coarse) {
// Switch off on hover
.md-version:hover & {
animation: hoverfix 250ms forwards;
}
// Enable on focus
.md-version:focus-within & {
animation: none;
}
}
} }
// Version selection item // Version selection item