From 53a536ae629d3890bff606f5fe4714d3526c0c5f Mon Sep 17 00:00:00 2001 From: Femi Novia Lina <77434812+FemiNoviaLina@users.noreply.github.com> Date: Sat, 14 May 2022 00:41:48 +0700 Subject: [PATCH] modify navbar --- public/js/navbar_script.js | 10 +++++----- resources/js/navbar_script.js | 10 +++++----- resources/views/components/navbar.blade.php | 20 ++++++++++++-------- routes/web.php | 1 + 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/public/js/navbar_script.js b/public/js/navbar_script.js index f08faa4..19925a7 100644 --- a/public/js/navbar_script.js +++ b/public/js/navbar_script.js @@ -9,6 +9,11 @@ var toggleMenu = document.getElementById('menu-toggle'); var menuList = document.getElementById('menu-list'); var menuOption = document.getElementsByClassName('rent-menu-option'); +toggleMenu.onclick = function (event) { + event.preventDefault(); + menuList.style.maxHeight = menuList.style.maxHeight == '0px' ? '1000px' : '0px'; +}; + menuOption[0].onclick = function (event) { event.preventDefault(); window.location.href = window.location.origin + '/find/car'; @@ -23,10 +28,5 @@ showButton.onclick = function (event) { event.preventDefault(); showMenu.style.display = showMenu.style.display == 'none' ? 'block' : 'none'; }; - -toggleMenu.onclick = function (event) { - event.preventDefault(); - menuList.style.maxHeight = menuList.style.maxHeight == '0px' ? '1000px' : '0px'; -}; /******/ })() ; \ No newline at end of file diff --git a/resources/js/navbar_script.js b/resources/js/navbar_script.js index d260171..f81b6be 100644 --- a/resources/js/navbar_script.js +++ b/resources/js/navbar_script.js @@ -4,6 +4,11 @@ const toggleMenu = document.getElementById('menu-toggle'); const menuList = document.getElementById('menu-list'); const menuOption = document.getElementsByClassName('rent-menu-option'); +toggleMenu.onclick = (event) => { + event.preventDefault(); + menuList.style.maxHeight = menuList.style.maxHeight == '0px' ? '1000px': '0px'; +} + menuOption[0].onclick = (event) => { event.preventDefault(); window.location.href = window.location.origin + '/find/car'; @@ -17,9 +22,4 @@ menuOption[1].onclick = (event) => { showButton.onclick = (event) => { event.preventDefault(); showMenu.style.display = showMenu.style.display == 'none' ? 'block': 'none'; -} - -toggleMenu.onclick = (event) => { - event.preventDefault(); - menuList.style.maxHeight = menuList.style.maxHeight == '0px' ? '1000px': '0px'; } \ No newline at end of file diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php index 31a034e..4e7116f 100644 --- a/resources/views/components/navbar.blade.php +++ b/resources/views/components/navbar.blade.php @@ -2,19 +2,23 @@