function ntbr() { var nt = document.querySelectorAll('.netto-price'); var br = document.querySelectorAll('.brutto-price'); nt.forEach(function(price) { price.style.display = price.style.display === 'none' ? 'inline-block' : 'none'; }); br.forEach(function(price) { price.style.display = price.style.display === 'inline-block' ? 'none' : 'inline-block'; }); } /* for the mobile view menu */ document.addEventListener("DOMContentLoaded", function() { var lastScrollTop = 0; var ntbrDiv = document.querySelector('div:has(>.ntbr)'); window.addEventListener('scroll', function(event) { if (window.innerWidth < 992) { var currentScrollTop = window.pageYOffset || document.documentElement.scrollTop; if (currentScrollTop > lastScrollTop) { // Scrolling down ntbrDiv.style.top = "25px"; } else { // Scrolling up ntbrDiv.style.top = "75px"; } // Update last scroll position lastScrollTop = currentScrollTop; } }); });