From 4b6f2ddcb6cd134e4636c81b4e8981b53965b76e Mon Sep 17 00:00:00 2001 From: MaragathaMeenakshi Date: Mon, 3 Jun 2024 18:57:37 +0530 Subject: [PATCH 1/4] Changes made in category list dropdown --- categorylist.css | 115 ++++++++++++++++++++++++++++++++++++++++------- categorylist.js | 53 +++++++++++++++++----- index.html | 15 +++++-- 3 files changed, 151 insertions(+), 32 deletions(-) diff --git a/categorylist.css b/categorylist.css index ed8bd0fc..8908bd89 100644 --- a/categorylist.css +++ b/categorylist.css @@ -12,8 +12,6 @@ body { .categorylist-wrapper { width: 100%; overflow-x: scroll; - position: absolute; - top: 8vh; right: 0; z-index: 500; } @@ -29,10 +27,9 @@ body { background-color: rgb(255, 253, 253); position: relative; padding: 0; - padding: 0 4%; + padding: 1% 4%; width: 100%; min-width: 1000px; - box-shadow: 0 0 10px rgb(87, 110, 172); } .categories > li { @@ -43,37 +40,28 @@ body { .categories > li > ul { display: none; - position: fixed; + /* position: fixed; */ background-color: rgb(201, 224, 252) !important; padding: 15px; gap: 15px 5px; flex-wrap: wrap; - width: 90vw; height: max-content; max-height: 100vh; - padding: 0 10%; top: 20vh; /* Adjust this value to move the subcategory menu down */ left: 70px; font-size: 14px; - overflow: hidden; - z-index: 500; -} - -.categories > li:hover > ul { - display: flex; - justify-content: left; - align-items: stretch; } .categories > li:hover { - background-color: #bac8f6; + background-color: #ffffff; transition: all 0.5s; border-radius: 20px; } .categories > li:hover > ul > li { margin: 15px 0; - flex: 1 1 200px; + position: relative; + /* flex: 1 1 200px; */ list-style-type: none; } @@ -98,3 +86,96 @@ body { margin-right: 10px; vertical-align: middle; } + +/* dropdown Nav bar */ +.dropdownbox { + /* left:20%; */ + position: absolute; + top:23%; + width:240px; + /* height:528px; */ + box-shadow: 0 8px 8px 1px rgba(0, 0, 0, .3); + border-radius: 8px; + background-color: #fff; + color: rgb(43, 42, 42); + line-height: 20px; + font-size: 12px; + z-index: 1000; +} +.grocery{ + left:10%; +} +.electronics{ + left:20%; +} +.clothing{ + left:30%; +} +.home-furniture{ + left:50%; +} +.beauty{ + left:65%; +} +.travel{ + left:70%; +} +.sports-stationary{ + left:80%; +} + +.dropdownbox > div > div + div{ + display: none; + position: absolute; + top:0%; + width:240px; + left: 100%; + box-shadow: 0 8px 8px 1px rgba(0, 0, 0, .3); + border-radius: 8px; + background-color: #fff; + line-height: 20px; +} + +.dropdownbox > div:hover > div + div{ + display: block; +} + +.sidearrow{ + display: none; + position: absolute; + right: 30px; + height: 6px; + width: 6px; + margin: 15px 0 15px 0; + border-color: #111112; + border-style: solid; + border-width: 0 1px 1px 0; + transform-origin: 50% 50%; + transform: translateY(75%) rotate(-45deg); +} +.dropdownbox > div{ + display: flex; +} +.dropdownbox > div > div:not(.subdropdown){ + padding: 12px 16px; +} +.dropdownbox > div:hover > div:not(.subdropdown){ + font-weight:bold; +} +.dropdownbox > div:hover{ + background-color:#cbdcf7; +} +.dropdownbox > div:hover >.sidearrow{ + display: block; +} +.subdropdown > div:first-child { + font-weight: bold; +} +.dropdownbox > div > div > div{ + padding: 12px 16px; + font-size: 12px; +} + +.subdropdown > div:hover{ + font-weight: bold; +} \ No newline at end of file diff --git a/categorylist.js b/categorylist.js index 5d6fd623..f99557a8 100644 --- a/categorylist.js +++ b/categorylist.js @@ -196,7 +196,7 @@ $(document).ready(function () { const categoriesList = $("#categories"); function createCategoryItem(categoryData) { - const categoryItem = $("
  • "); + const categoryItem = $("
  • ").attr('id', `${categoryData.id}`); const categoryLink = $("").attr("href", `#${categoryData.id}`).text(categoryData.name); // Adding images to the main category items only @@ -205,15 +205,16 @@ $(document).ready(function () { categoryItem.append(categoryLink); - const subcategoriesList = $("