I want all the elements on my website with the class '.page' to slide to the left when I click the navigation button. It works with querySelector but with querySelectorAll it gives an error that it can't read it for some reason. I just want all the .page elements to add active to them.
<script type="text/javascript">
function toggleMenu(){
var menuToggle = document.querySelector('.toggle');
var page = document.querySelectorAll('.page');
menuToggle.classList.toggle('active');
page.classList.toggle('active');
}
let home = document.querySelector("section.banner");
window.addEventListener('scroll', function(){
var value = window.scrollY;
home.style.top = value * 0.5 + 'px';
})
</script>
page.classList.toggle('active'); comes back saying it can't read it.
Any help would be appreciated, thank you