Javascript 30 (Day 24)
Sticky Nav
Aug 24, 2017 · 1 min read
Demo can be found here.
What I learned on this mini-project.
position: fixed
The main purpose of this project was to learn about the effects of changing an elements position to fixed.
When applying this property, the element is essentially taken out of the DOM which vacates the space it previously held in it.
This causes a reshuffle for the other elements, which can cause a judder when an elements position is changed to fixed.
One workaround to this, is to fill in the space vacated by adding padding. This can be done multiple ways, but it makes sense to make this value dynamic, so that it adapts when the layout of the page is changed.
Originally published at gist.github.com.
