![](/img/trans.png)
[英]Is there anyway to make this div come back when you scroll to top again
[英]Make div top two divs fixed after some scroll and reset back when scrolled to top again?
嗨,我想在父div滚动后使div保持固定?
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="fw ofndr-box">
<div class="ofndr-box-half add-here">
<a href="#!/lead-court/5c0622ad78bdba5f566538d8" style="color: white;">Header 1</a>
</div>
<div class="ofndr-box-half2 add-here">
<a href="#" data-ng-click="addrequestpopup()" class="ofndr-btn pull-right">+New</a>
</div>
<div class="fw ofndr-box-in">
</div>
</div>
</div>
这是我正在工作的小提琴,我想在蓝色div滚动后修复标题和+ new按钮。 https://jsfiddle.net/pavansn/tvg3d709/1/
由于滚动条位于ofndr-box
而不是window
因此在Js中,您可以尝试
var scroll = $('.ofndr-box').scrollTop();
并更改:
$(".add-here").addClass(".fixed"); to $(".add-here").addClass("fixed");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.