From 2384c291df7e2e9d37142683997d113edebba2ac Mon Sep 17 00:00:00 2001
From: ShadyLane
Date: Wed, 2 Oct 2024 11:07:41 +0530
Subject: [PATCH 1/2] Added a Cart Icon with functionality to add and remove
items from cart
---
assets/css/style.css | 39 ++++++++++++++++++++--
assets/js/script.js | 41 ++++++++++++++++++++++-
index.html | 78 ++++++++++++++++++++++++++++++++++++++++----
3 files changed, 148 insertions(+), 10 deletions(-)
diff --git a/assets/css/style.css b/assets/css/style.css
index 380dfd7..fa958b3 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -264,6 +264,17 @@ body.nav-active { overflow: hidden; }
margin-inline: auto;
}
+/* Cart anchor styling */
+#cart-anchor {
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+}
+
+#cart-anchor:hover .span {
+ color: var(--gold-crayola); /* Similar hover effect as other items */
+}
+
.contact-number::after { bottom: -5px; }
.text-center { text-align: center; }
@@ -303,6 +314,11 @@ body.nav-active { overflow: hidden; }
padding: 12px 45px;
overflow: hidden;
z-index: 1;
+
+
+}
+.menu-card .add-to-cart {
+ margin-left: 15px; /* Adds space between price and button */
}
.btn::before {
@@ -992,9 +1008,28 @@ body.nav-active { overflow: hidden; }
.menu-card {
display: flex;
- align-items: flex-start;
- gap: 20px;
+ /* align-items: flex-start; */
+ /* gap: 20px; */
}
+.menu-card {
+ display: grid;
+ grid-template-columns: 150px 500px 300px 300px;
+ grid-template-rows: auto; /* Two equal columns */
+ /* height: 50px; */
+ row-gap: 5px;
+ gap: 20px; /* Gap between the columns */
+ align-items: center; /* Aligns buttons vertically */
+}
+
+/* .menu-card .btn {
+ width: 150px;
+ text-align: center;
+} */
+
+/* .menu-card .title-wrapper {
+ margin-bottom: 15px;
+} */
+
.hover\:card .card-banner { background-color: var(--gold-crayola); }
diff --git a/assets/js/script.js b/assets/js/script.js
index 6403e32..5f8bc71 100644
--- a/assets/js/script.js
+++ b/assets/js/script.js
@@ -23,6 +23,44 @@ const addEventOnElements = function (elements, eventType, callback) {
}
}
+// Select the cart anchor and elements
+const cartAnchor = document.getElementById("cart-anchor");
+const addToCartButtons = document.querySelectorAll(".add-to-cart");
+const removeFromCartButtons = document.querySelectorAll(".remove");
+
+let cartItemCount = 0;
+
+// Function to update cart text
+const updateCartDisplay = () => {
+ if (cartItemCount > 99) {
+ cartAnchor.querySelector(".span").textContent = "Cart 99+";
+ } else if (cartItemCount > 0) {
+ cartAnchor.querySelector(".span").textContent = `Cart ${cartItemCount}`;
+ } else {
+ cartAnchor.querySelector(".span").textContent = "Cart";
+ }
+};
+
+// Add event listeners to "Add to Cart" buttons
+addToCartButtons.forEach(button => {
+ button.addEventListener("click", () => {
+ cartItemCount += 1;
+ updateCartDisplay();
+ });
+});
+
+// Add event listeners to "Remove" buttons
+removeFromCartButtons.forEach(button => {
+ button.addEventListener("click", () => {
+ if (cartItemCount > 0) {
+ cartItemCount -= 1;
+ updateCartDisplay();
+ }
+ });
+});
+
+// Initialize the cart display on page load
+window.addEventListener("load", updateCartDisplay);
/**
@@ -141,4 +179,5 @@ window.addEventListener("mousemove", function (event) {
parallaxItems[i].style.transform = `translate3d(${x}px, ${y}px, 0px)`;
}
-});
\ No newline at end of file
+});
+
diff --git a/index.html b/index.html
index e97ba51..fcd4a96 100644
--- a/index.html
+++ b/index.html
@@ -87,10 +87,16 @@
Number
+
+
+
+
+ Cart
+
-
+
@@ -332,8 +338,8 @@
We Offer Top Notch
- Enjoy a premium dining experience with exceptional culinary artistry at Grilli.
-
+ Get the best in class dining experience with the most articulate culinary craftsmanship at Grilli. Bon Apétit!
+
@@ -431,7 +437,7 @@
Our Story
- Every favour tells a story
+ Where Every Flavor Tells a Story
Every dish is prepared articulately with our chef's utmost skills. This has made us one of the few Michelin Star rated hotels across the world. Our finely blended wines are one of the most exquisite and have been featured at the wine spectator awards. Check them out from our drinks section!
@@ -495,7 +501,7 @@
Every favour tells a story
Lobster Tortellini
- Lobster Tortellini showcases tender pasta pockets stuffed with juicy lobster, bathed in a creamy, herb-infused sauce with a touch of zesty citrus. This exquisite dish merges Italian culinary artistry with premium seafood for an extraordinary dining indulgence.
+ Lobster Tortellini features delicate pasta parcels filled with succulent lobster, served in a rich, velvety sauce infused with fresh herbs and a hint of citrus. This luxurious dish blends Italian craftsmanship with the finest seafood for an unforgettable dining experience.
@@ -561,7 +567,14 @@
-
+
+ Add to Cart
+ Add to Cart
+
+
+ Remove
+ Remove
+
@@ -588,6 +601,14 @@
+
+ Add to Cart
+ Add to Cart
+
+
+ Remove
+ Remove
+
@@ -615,6 +636,14 @@
+
+ Add to Cart
+ Add to Cart
+
+
+ Remove
+ Remove
+
@@ -644,6 +673,14 @@
+
+ Add to Cart
+ Add to Cart
+
+
+ Remove
+ Remove
+
@@ -671,6 +708,14 @@
+
+ Add to Cart
+ Add to Cart
+
+
+ Remove
+ Remove
+
@@ -698,7 +743,14 @@
-
+
+ Add to Cart
+ Add to Cart
+
+
+ Remove
+ Remove
+
@@ -1183,6 +1235,18 @@
+
+
+
+
+
+
+
+
+
+
From 66f31a3bca16a5fd242cffcdfa4ec6cd1e5c1f35 Mon Sep 17 00:00:00 2001
From: ShadyLane
Date: Thu, 3 Oct 2024 13:10:15 +0530
Subject: [PATCH 2/2] Added links to footer section using JavaScript
---
assets/css/style.css | 40 +++++++++++++++++++++++++++++++++++++++-
assets/js/script.js | 18 +++++++++++++++---
index.html | 10 +++++-----
3 files changed, 59 insertions(+), 9 deletions(-)
diff --git a/assets/css/style.css b/assets/css/style.css
index fa958b3..a2f726b 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -2086,4 +2086,42 @@ textarea.input-field {
left: 0;
}
-}
\ No newline at end of file
+}
+
+.footer-list .footer-link {
+ position: relative;
+ display: inline-block;
+ padding-bottom: 2px;
+ transition: color 0.3s ease-in-out;
+}
+
+.footer-list .footer-link::before,
+.footer-list .footer-link::after {
+ content: "";
+ position: absolute;
+ left: 50%;
+ bottom: 0;
+ width: 0;
+ height: 2px;
+ background-color: #000;
+ transition: width 0.4s ease, left 0.4s ease, background-color 0.3s ease-in-out;
+}
+
+.footer-list .footer-link::before {
+ transform: translateY(-4px);
+}
+
+.footer-list .footer-link::after {
+ transform: translateY(4px);
+}
+
+.footer-list .footer-link:hover::before,
+.footer-list .footer-link:hover::after {
+ width: 100%;
+ left: 0;
+ background-color: #e4c491;
+}
+
+.footer-list .footer-link:hover {
+ color: #e4c491;
+}
diff --git a/assets/js/script.js b/assets/js/script.js
index 5f8bc71..51985e6 100644
--- a/assets/js/script.js
+++ b/assets/js/script.js
@@ -23,6 +23,18 @@ const addEventOnElements = function (elements, eventType, callback) {
}
}
+let youtube = "https://www.youtube.com";
+let instagram = "https://www.instagram.com";
+let twitter = "https://www.x.com";
+let maps = "https://maps.google.com";
+let facebook = 'https://www.facebook.com';
+
+document.querySelector("#twt").setAttribute('href', twitter);
+document.querySelector("#utube").setAttribute('href', youtube);
+document.querySelector("#map").setAttribute('href', maps);
+document.querySelector("#instagram").setAttribute('href', instagram);
+document.querySelector("#facebook").setAttribute('href', facebook);
+
// Select the cart anchor and elements
const cartAnchor = document.getElementById("cart-anchor");
const addToCartButtons = document.querySelectorAll(".add-to-cart");
@@ -63,6 +75,8 @@ removeFromCartButtons.forEach(button => {
window.addEventListener("load", updateCartDisplay);
+
+
/**
* NAVBAR
*/
@@ -89,7 +103,6 @@ const emailElements = document.querySelectorAll("[data-email]");
//click event now
addEventOnElements(emailElements, "click", openMailClient);
-
/**
* HERO SLIDER
*/
@@ -151,8 +164,7 @@ addEventOnElements([heroSliderNextBtn, heroSliderPrevBtn], "mouseover", function
});
addEventOnElements([heroSliderNextBtn, heroSliderPrevBtn], "mouseout", autoSlide);
-
-window.addEventListener("load", autoSlide);
+w.addEventListener("load", autoSlide);
diff --git a/index.html b/index.html
index fcd4a96..9100696 100644
--- a/index.html
+++ b/index.html
@@ -1202,23 +1202,23 @@