<div style="height:3200px;background-color: #B15F5F"></div>
<div style="height:100px;background-color: #619A51" id="demo">当滚到到这个div,隐藏下面的按钮</div>
<div style="height:3300px;background-color: #645FB1" ></div>
<div style="height:2100px;background-color: #F18733"></div>
<a href="javascript:;" class="box" id="btn">按钮</a>
<script type="text/javascript">
$(function(){
var demoHeight = $("#demo").offset().top;
window.onscroll=function(){
var this_scrollTop = $(this).scrollTop();
if(this_scrollTop>demoHeight ){
$("#btn").hide(1000);
}else{
$("#btn").show(1000);
}
};
});
</script>
2 条评论
对对对
:arrow: :cool: :idea: