简体   繁体   English

Bootstrap 4 固定和粘性 header

[英]Bootstrap 4 fixed and sticky header

I need your help please help me.我需要你的帮助请帮助我。 Can i use position fixed and position sticky in a single page.我可以在单个页面中使用固定的 position 和粘性的 position 吗? I want position fixed for primary header and sticky for secondary header.我想要 position 固定用于主要 header 和粘性用于辅助 header。

Thank you in Advance先感谢您

This should work as long as you implement the onscroll function.只要您实现滚动 function,这应该就可以工作。

you would need to set a property for the second header so it properly sits below the current and then when onscroll is triggered it would toggle the css class you define to make the secondary header sticky to the top.您需要为第二个 header 设置一个属性,以便它正确地位于当前下方,然后当触发 onscroll 时,它将切换您定义的 css class 以使辅助 header 粘在顶部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM