diff --git a/script.js b/script.js index 16b9a0f..3730571 100644 --- a/script.js +++ b/script.js @@ -114,7 +114,7 @@ const cards = [ ]; const navigationItems = document.querySelectorAll(".nav__item"); -const url = window.location.href; +const url = window.location.pathname; let subscribe; navigationItems.forEach((item) => { @@ -131,7 +131,7 @@ navigationItems.forEach((item) => { }); const cardsToShow = - url === "http://127.0.0.1:5500/" ? cards : cards.slice(0, 4); + url === "/" || url === "/index.html" ? cards : cards.slice(0, 4); cardsToShow.forEach((card, index) => { const div = document.createElement("div"); @@ -172,7 +172,7 @@ subscribe.forEach((el) => { }); }); -if (url === "http://127.0.0.1:5500/about.html") { +if (url === "/about.html") { const cardFromStorage = JSON.parse(localStorage.getItem("card")); const div = document.createElement("div");