问题描述
当我向下滚动页面时,我希望固定在页面顶部的固定导航栏显示在所有内容上,但是当我向下滚动时,轮播会最终显示在导航栏的顶部。
我试图给轮播设置一个z-index:0,带有!important标签,向导航栏给出一个z-index:1,但是没有成功。附有一张照片,显示我正在谈论的问题。
解决方法
给固定导航栏的zindex一些更高的值,例如
z-index: 1090
我将导航栏包裹在一个粘性div中:-
<div className="sticky-top" style={{ zIndex: 1090 }}>
<Navbar></Navbar>
</div>
顺便说一句,我使用react-bootstrap。