aashnajena commented on a change in pull request #254: [CAMEL-14695] Improve
Mobile Main-Menu
URL: https://github.com/apache/camel-website/pull/254#discussion_r397222277
##########
File path: antora-ui-camel/src/js/04-mobile-navbar.js
##########
@@ -9,4 +9,21 @@ document.addEventListener('DOMContentLoaded', function () {
document.documentElement.classList.toggle('is-clipped--navbar')
})
})
+
+ var menuDropDowns =
Array.prototype.slice.call(document.querySelectorAll('.has-dropdown'), 0)
+ var maxMobileWidth = 1023
+ menuDropDowns.forEach(function (el) {
+ el.addEventListener('click', function (e) {
+ var dropDownMenu = el.querySelectorAll('.navbar-dropdown')[0]
+ if (window.innerWidth <= maxMobileWidth) {
+ if (dropDownMenu.style.display === 'block') {
+ dropDownMenu.style.display = 'none'
+ } else {
+ dropDownMenu.style.display = 'block'
+ }
+ } else {
+ dropDownMenu.style.display = 'none'
+ }
+ })
+ })
Review comment:
Thanks! This is definitely a better way of doing it. I hope the changes are
fine now. I have toggled the class and added the necessary css to change the
display and invert the arrow.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services