Switch div from fixed to absolute at bottom of browser

前端 未结 5 1938
梦毁少年i
梦毁少年i 2021-01-18 01:51

Im trying to add a footer at the bottom of this content that doesn\'t overlay the content but moves it up.

The only way I can see it working would be something like,

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 02:07

    Based on the question you asked i think this is what you mean. The red div should be fixed when it gets to the top but be absolute when it is below the top for scrolling and the black footer should be below the red while scrolling, check this code i have done for you. just add this jquery script and run it.

    
    
    

提交回复
热议问题