'use strict' const handleHomeScroll = function () { const mobile = window.matchMedia('(max-width: 768px)').matches; const tablet = window.matchMedia('(min-width: 769px) and (max-width: 1024px)').matches; const desktop = window.matchMedia('(min-width: 1025px)').matches; const scroll = window.scrollY; const items = document.getElementById('home-page-items'); const favorites = document.getElementById('home-page-favorites'); var difference = 184 // if (mobile) { // difference = 138; // } // if (tablet) { // difference = 184; // } const itemsHeight = items.scrollHeight; const favoritesHeight = favorites.scrollHeight; const windowHeight = window.innerHeight; if (scroll > ((((itemsHeight - windowHeight) + 60) + favoritesHeight + difference) - 50)) { favorites.style.position = 'relative'; items.style.marginBottom = '20px'; } else { favorites.style.position = 'fixed'; items.style.marginBottom = '215px'; } }; export { handleHomeScroll };