diff --git a/website/cart.js b/website/cart.js index d90e190..7048aac 100644 --- a/website/cart.js +++ b/website/cart.js @@ -1,6 +1,10 @@ + + // Array to hold items added to the shopping cart const cart = []; + + // Functie om een item aan het winkelwagentje toe te voegen function addToCart(item) { cart.unshift(item); // Add item to the beginning of the cart array @@ -8,6 +12,8 @@ function addToCart(item) { closeModal(); } + + // Functie om het winkelwagentje bij te werken function updateCart() { const cartItemsContainer = document.getElementById("cart-items"); @@ -35,6 +41,7 @@ function updateCart() { } } + // Functie om een item uit het winkelwagentje te verwijderen function removeFromCart(index) { cart.splice(index, 1); @@ -43,3 +50,9 @@ function removeFromCart(index) { // Initial call to updateCart to ensure the button is hidden on page load updateCart(); + +// Functie om het modaal venster te sluiten +function closeModal() { + document.getElementById('modal').style.display = 'none'; +} + diff --git a/website/index.html b/website/index.html index 4b9392e..6c24724 100644 --- a/website/index.html +++ b/website/index.html @@ -6,6 +6,7 @@