how to use vh units instead of pixels for .scrolltop functions
问题 I have a menu bar who's class I want to change after a users scrolls to the next div, the div is 100vh tall. The function below works only with screens my size, anything smaller or bigger the animation will go to early or too late. How do I make the units that this function uses vh? Thanks $(window).scroll(function() { var scroll = $(window).scrollTop(); if (scroll >= 600) { <---- change to vh units not px----- $(".home").removeClass("open"); } 回答1: 100vh is the actual view height of that