Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirmation Message for Adding Items to Cart - Enhanced User Awareness #789

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 69 additions & 1 deletion Html-files/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,53 @@
.fa-brands.fa-x-twitter:hover {
color: #181e20 !important;
}




.popup-modal {
position: fixed;
top: 2.5rem;
left: 50%;
transform: translateX(-50%);
background-color: #ffffff;
color: #000000;
padding: 18px 32.5px 2px 32.5px;
border-radius: 30px;
font-size: 16px;
z-index: 100000;
box-shadow: 0 15px 50px 0 rgba(0,0,0,.35);
font-size: .9rem;
display: flex;
display: none;
gap: .5rem;
align-items: center;
width: 40px;
max-width: 90%;
width: max-content;
text-align: center;
}

.popup-modal.show {
display: flex;
gap: .5rem;
opacity: 1;
transition: opacity 0.3s ease-in-out;
}

.popup-modal.fade-out {
opacity: 0;
transition: opacity 0.3s ease-in-out;
}

</style>
</head>

<body>
<div id="popup-modal" class="popup-modal">
<p id="popup-message"></p>
</div>

<div class="circle-container">
<div class="circle" style="background-color: rgb(255, 181, 107); left: 504px; top: 59px; scale: 1;"></div>
<div class="circle" style="background-color: rgb(253, 175, 105); left: 504px; top: 59px; scale: 0.95;"></div>
Expand Down Expand Up @@ -977,8 +1020,33 @@ <h4 style="font-family: var(--ff-philosopher);color: hsl(304, 14%, 46%);">Follow
const badgeCountElement = document.getElementById('badgeCount');
let currentCount = parseInt(badgeCountElement.innerText);
badgeCountElement.innerText = currentCount + 1;
showPopup("Item added to Cart succesfully!!");
})
}

function showPopup(message,type='success') {
let popupModal = document.getElementById('popup-modal');
let popupMessage = document.getElementById('popup-message');

if (type==='error'){
popupMessage.innerHTML = `<i class="fa-solid fa-circle-xmark" style="color: #dc3545"></i> ${message}`;
}
else {
popupMessage.innerHTML = `<i class="fa-solid fa-circle-check" style="color: #05a571"></i> ${message}`;
}

popupModal.classList.add('show');
setTimeout(() => {
popupModal.classList.add('fade-out');
}, 500);

setTimeout(() => {
popupModal.classList.remove('show', 'fade-out');
}, 1000);
}




// document.getElement('add-to-cart-button').addEventListener('click', function() {
// const badgeCountElement = document.getElementById('badgeCount');
Expand All @@ -992,4 +1060,4 @@ <h4 style="font-family: var(--ff-philosopher);color: hsl(304, 14%, 46%);">Follow
<script src="https://cdn.gtranslate.net/widgets/latest/float.js" defer></script>
</body>

</html>
</html>