Tiffin food
This commit is contained in:
parent
5ced0d0812
commit
4697dab339
8 changed files with 431 additions and 0 deletions
18
TheTiffinFood/script.js
Normal file
18
TheTiffinFood/script.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
document.querySelectorAll(".meal-card").forEach((card) => {
|
||||
const openPricing = () => {
|
||||
window.location.href = `pricing.html?mode=${encodeURIComponent(card.dataset.mode)}`;
|
||||
};
|
||||
|
||||
card.querySelector(".card-action").addEventListener("click", openPricing);
|
||||
card.addEventListener("click", (event) => {
|
||||
if (event.target.closest(".card-action")) return;
|
||||
openPricing();
|
||||
});
|
||||
|
||||
card.addEventListener("keydown", (event) => {
|
||||
if ((event.key === "Enter" || event.key === " ") && event.target === card) {
|
||||
event.preventDefault();
|
||||
openPricing();
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue