The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Change font-size while scrolling Reply To: Change font-size while scrolling



var mass = Math.max(2, 5-0.01*$(this).scrollTop()) + 'vw';

First number there (2) is the minimum size in vw it will shrink to, 5 should match what’s defined in the CSS and 0.01 is the factor that determines how fast it’ll shrink with scrolling.

Edit – using font-size is how they do it on the example page you linked to. I think I would personally probably choose to go with a transform: scale instead. Something like this: