-
-
Notifications
You must be signed in to change notification settings - Fork 987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored mobile-menu.js
#1921
base: main
Are you sure you want to change the base?
Conversation
- Stopped using jQuery - Moved refactored code to `djangoproject.js`
|
||
// Toggle mobile menu on button click | ||
document.querySelector('.menu-button').addEventListener('click', function () { | ||
const menu_el = document.querySelector('#top [role="navigation"]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified the selector here since an id
is present on the element. Before it was [role="banner"] [role="navigation"]
.
@@ -137,7 +137,6 @@ | |||
"jquery.flot": extless("{% static 'js/lib/jquery.flot.min.js' %}"), | |||
"mod/floating-warning": extless("{% static 'js/mod/floating-warning.js' %}"), | |||
"mod/list-collapsing": extless("{% static 'js/mod/list-collapsing.js' %}"), | |||
"mod/mobile-menu": extless("{% static 'js/mod/mobile-menu.js' %}"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
djangoproject.js
You can test this by making your window narrow and clicking this button in the top-right corner: