commit all.

This commit is contained in:
Anurag Jangid 2026-10-08 02:23:34 +05:30
parent 6ed0c48f4e
commit 3f6d7bd638
3 changed files with 134 additions and 0 deletions

17
script.js Normal file
View file

@ -0,0 +1,17 @@
const toast = document.querySelector(".toast");
const showToast = (goal) => {
toast.textContent = `${goal} mode selected — your box is almost ready.`;
toast.classList.add("show");
window.setTimeout(() => toast.classList.remove("show"), 3200);
};
document.querySelectorAll(".meal-card").forEach((card) => {
const action = card.querySelector(".card-action");
action.addEventListener("click", () => showToast(card.dataset.goal));
card.addEventListener("keydown", (event) => {
if ((event.key === "Enter" || event.key === " ") && event.target === card) {
event.preventDefault();
showToast(card.dataset.goal);
}
});
});