From 2cd2e4b536b7e8881b8e0c892ee0d8cb78550c30 Mon Sep 17 00:00:00 2001 From: Viktor Svertoka <115661003+ViktorSvertoka@users.noreply.github.com> Date: Wed, 24 Jan 2024 21:47:38 +0200 Subject: [PATCH] Update 14-added-local.js --- src/js/14-added-local.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/js/14-added-local.js b/src/js/14-added-local.js index a0ac559..c3ec628 100644 --- a/src/js/14-added-local.js +++ b/src/js/14-added-local.js @@ -55,9 +55,6 @@ export function renderFavorite() { } } -/** - * Favorites section. Scroll apearence and width control in a desktop breakpoint so that the shadow of a single card fits into the card-list container. - */ document.addEventListener('DOMContentLoaded', () => { const listContainer = document.querySelector('.favorites__list'); const listItemSelector = '.fav-filters__item-card'; @@ -82,23 +79,19 @@ document.addEventListener('DOMContentLoaded', () => { } }; - // A function for checking the break point and applying styles const applyStyles = () => { const screenWidth = window.innerWidth || document.documentElement.clientWidth; if (screenWidth >= 1440) { checkWidth(); } else { - // For smaller screens, reset the established styles listContainer.style.width = 'auto'; } }; - // We call both functions when the page is loaded checkScroll(); applyStyles(); - // We set up mutation observers to track changes inside the container const observerScroll = new MutationObserver(mutations => { checkScroll(); }); @@ -109,6 +102,5 @@ document.addEventListener('DOMContentLoaded', () => { }); observerWidth.observe(listContainer, { childList: true, subtree: true }); - // We add a window size change listener to update styles when the width is changed window.addEventListener('resize', applyStyles); });