1.navigation {
2 /* fixed keyword is fine too */
3 position: sticky;
4 top: 0;
5 z-index: 100;
6 /* z-index works pretty much like a layer:
7 the higher the z-index value, the greater
8 it will allow the navigation tag to stay on top
9 of other tags */
10}
1nav {
2 position:sticky;
3 top:0;
4}
5
6/*Top can be replaced with bottom, left, or right
7 depending on what you want :) */
1// sticky Header js plugin
2let w_out_sticky = document.querySelector(".w-out")// terget class or id
3 // hear is scroll logic
4window.addEventListener('scroll', () => {
5 window.scrollY > 300 ? w_out_sticky.classList.add("sticky") : w_out_sticky.classList.remove("sticky")
6})