diff --git a/donation_website/index.html b/donation_website/index.html index a3049c9..cb472d7 100644 --- a/donation_website/index.html +++ b/donation_website/index.html @@ -88,14 +88,16 @@
-
+
+ +
@@ -136,6 +138,23 @@ + +
+
+
+
+ Search + +
+ +
+
+
diff --git a/donation_website/main.js b/donation_website/main.js index 388bf2e..652accd 100644 --- a/donation_website/main.js +++ b/donation_website/main.js @@ -14,4 +14,14 @@ for (let x = 0; x < menuTrigger.length; x++){ }) closeTrigger[x].addEventListener('click', closeMenu); overlay.addEventListener('click', closeMenu) -} \ No newline at end of file +} +//submenu +const submenu = document.querySelectorAll('.sub-trigger'); + submenu.forEach((menu) => menu.addEventListener('click', toggle)); + + function toggle(){ + submenu.forEach((item) => item != this ? item.classList.remove('expand') : null); + if(this.classList != 'expand'){ + this.classList.toggle('expand') + } + } diff --git a/donation_website/style.css b/donation_website/style.css index f8a7f98..e1898a7 100644 --- a/donation_website/style.css +++ b/donation_website/style.css @@ -147,7 +147,7 @@ header li a:hover{ .header-main :where(nav > ul > li >a span, .logo){ font-weight: 600; } -/*---------- mobile menu ----------*/ +/*---------- mobile menu & submenu----------*/ .overlay{ position: fixed; top: 0; @@ -168,7 +168,7 @@ nav.mobile{ position: fixed; top: 0; left: 0; - width: 350px; + width: 300px; height: 100%; max-width: calc(100vw -60px); padding: 30px; @@ -240,9 +240,76 @@ nav.mobile .submenu a{ nav.mobile .submenu a:hover{ color: black; } - - - +nav.mobile .submenu{ + transform: translateY(15px); + transition: height 0.3s, transform 0.3s; +} +nav.mobile .expand ~ .submenu{ + height: auto; + transform: translateY(0); +} +/*---------- search ----------*/ +.search-modal{ + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + padding: 30px 0; + background-color: whitesmoke; + z-index: 1000; + opacity: 0; + visibility: hidden; +} +.search-modal.active{ + opacity: 1; + visibility: visible; +} +.search-modal .wrap{ + max-width: 640px; + margin: 0 auto; +} +.search-modal .search-head{ + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 40px; +} +form.search{ + position: relative; + height: 45px; + background-color: whitesmoke; + display: flex; + justify-content: space-between; + align-items: center; +} +form.search input{ + position: absolute; +} +form.search input[type=search]{ + width: 100%; + height: 45px; + left: 0; + top: 0; + padding: 10px 15px 10px 40px; + border: 1px solid gray; + border-radius: 5px; +} +form.search input[type=submit]{ + right: 0; + top: 0; + border: 0; + background-color: transparent; + color: transparent; + height: 100%; + cursor: pointer; + z-index: 10; +} +form.search i{ + position: relative; + z-index: 1; + padding: 0 15px; +} @@ -284,4 +351,6 @@ nav.mobile .submenu a:hover{ opacity: 1; visibility: visible; } -} \ No newline at end of file + +} +