如何在滚动时粘贴 div
看我的截图:
如果粘在顶部,则此屏幕截图:
这个屏幕截图在滚动时粘滞:
我的意思是这样,如果粘性转到顶部 div 恢复正常(我的意思是没有 css 粘性)
看到这个屏幕截图,我想要这样,如果 div 棒回到顶部恢复正常(没有 css 粘性):
这是我的粘性:
@media screen and (min-width: 768px) {
.sticky {
position: fixed;
z-index: 9999;
display: block;
background-color: #2069e8;
width: 100%;
padding: 10px;
margin-top: -10px;
padding-top:10px
}
}Run Code Online (Sandbox Code Playgroud)
<div class="sticky">
<div class="col-sm-2">
<h2 style="margin:0px; width:250px;"><span class="smallnav menustater" onclick="openNav()"><i class="fa fa-th-list"></i></span> <a href="http://myweb.com" style="color:#ffffff; text-decoration:none; position:absoulute; display:block; margin-top:-33px; margin-left:38px; z-index:5; width:250px; font-weight:bold;">MY WEB</a></h2>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
请帮忙
之前谢谢