Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamzap
Copy link
Member

@adamzap adamzap commented Feb 1, 2025

  • Stopped using jQuery
  • Moved refactored code to djangoproject.js

You can test this by making your window narrow and clicking this button in the top-right corner:

image

- 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"]');
Copy link
Member Author

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' %}"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

Copy link
Member

@pauloxnet pauloxnet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants