From ff2dfd42d7b815295684c64a0136231a7676aa3e Mon Sep 17 00:00:00 2001 From: Maksim Tananykin Date: Tue, 18 Oct 2022 12:35:21 +0300 Subject: [PATCH] fix bugs --- script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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");