Position fixed when scrolled passed certain amount of pixels

前端 未结 5 1794
傲寒
傲寒 2021-02-06 17:10

I\'m looking for a way to position the #header element of my page as \"Fixed\" only after having scrolled downward for about 170 pixels.

Above the header is a banner, so

5条回答
  •  清酒与你
    2021-02-06 17:42

    I think this should work: http://jsfiddle.net/Skooljester/K2mFT/. However, you'll need to define a width on your header or else it'll shrink when it becomes fixed.

提交回复
热议问题