0👍
To show the menu according to screensize
You can use jquery to get browser viewport width.
$(window).width();
Then write a function which will check screen width and return true/false.
showMenu() {
let screenWidth = $(window).width()
if (screenWidth < 767) {
return true
} else {
return false
}
}
To hide the menu
- Use Vue Clickaway to check if someone clicks outside the menu.
-
Write before each navigation guard to hide the menu.
router.beforeEach((to, from, next) => { this.hideMenu() // Hides the Menu next() })
Source:stackexchange.com