30 ms·
For images that just stay fixed, background-attachment: fixed does the job nicely. For things like parallax, stuff popping into view, etc, you basically write a
by woah 13y ago
For images that just stay fixed, background-attachment: fixed does the job nicely. For things like parallax, stuff popping into view, etc, you basically write a function that gets called on scroll events and does what you need. It usually ends up being kind of hacky, with magical equations that take the value from .scrollTop() (jquery) as an input. It's best not to overthink these things.
Bootstrap has an affix function which will help you make nav bars that stick to the top of the page. There are many other 'scrolling frameworks' out there, but I've found them to be a waste of time, myself.