Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rescheduled 🗓️
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
c3lingo
rescheduled 🗓️
Commits
6d536693
Unverified
Commit
6d536693
authored
10 months ago
by
tribut
Browse files
Options
Downloads
Patches
Plain Diff
Clean up animation of mobile menu when navigating to a new page
Only on mobile FF apparently, maybe some side effect of turbo morph?
parent
257c1ede
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/javascript/controllers/navigation_controller.js
+8
-3
8 additions, 3 deletions
app/javascript/controllers/navigation_controller.js
with
8 additions
and
3 deletions
app/javascript/controllers/navigation_controller.js
+
8
−
3
View file @
6d536693
import
{
Controller
}
from
"
@hotwired/stimulus
"
import
{
Controller
}
from
"
@hotwired/stimulus
"
function
delayAfterAnimate
(
fn
)
{
setTimeout
(()
=>
{
fn
();
},
window
.
matchMedia
(
"
(prefers-reduced-motion: reduce)
"
).
matches
?
0
:
300
);
// Should match the duration in tailwind.config.js
}
export
default
class
extends
Controller
{
export
default
class
extends
Controller
{
static
targets
=
[
"
mobileMenu
"
];
static
targets
=
[
"
mobileMenu
"
];
...
@@ -9,12 +15,11 @@ export default class extends Controller {
...
@@ -9,12 +15,11 @@ export default class extends Controller {
menu
.
classList
.
remove
(
'
hidden
'
);
menu
.
classList
.
remove
(
'
hidden
'
);
menu
.
classList
.
remove
(
'
motion-safe:animate-slideOut
'
);
menu
.
classList
.
remove
(
'
motion-safe:animate-slideOut
'
);
menu
.
classList
.
add
(
'
motion-safe:animate-slideIn
'
);
menu
.
classList
.
add
(
'
motion-safe:animate-slideIn
'
);
delayAfterAnimate
(()
=>
{
menu
.
classList
.
remove
(
'
motion-safe:animate-slideIn
'
);});
// helps with some jank on page reload on mobile FF
}
else
{
}
else
{
menu
.
classList
.
remove
(
'
motion-safe:animate-slideIn
'
);
menu
.
classList
.
remove
(
'
motion-safe:animate-slideIn
'
);
menu
.
classList
.
add
(
'
motion-safe:animate-slideOut
'
);
menu
.
classList
.
add
(
'
motion-safe:animate-slideOut
'
);
setTimeout
(()
=>
{
menu
.
classList
.
add
(
'
hidden
'
);
},
delayAfterAnimate
(()
=>
{
menu
.
classList
.
add
(
'
hidden
'
);})
window
.
matchMedia
(
"
(prefers-reduced-motion: reduce)
"
).
matches
?
0
:
300
);
// Should match the duration in tailwind.config.js
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment