我希望在从页面顶部向下滚动800px后显示隐藏的div.到目前为止我有这个例子,但我想它需要修改才能实现我想要的东西.
编辑:
[当scrollUp和高度小于800px时,这个div应隐藏]
HTML:
<div class="bottomMenu">
<!-- content -->
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.bottomMenu {
width: 100%;
height: 60px;
border-top: 1px solid #000;
position: fixed;
bottom: 0px;
z-index: 100;
opacity: 0;
}
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$(document).ready(function() {
$(window).scroll( function(){
$('.bottomMenu').each( function(i){
var bottom_of_object = $(this).position().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
if( bottom_of_window > bottom_of_object ){
$(this).animate({'opacity':'1'},500);
}
});
});
});
Run Code Online (Sandbox Code Playgroud)
这是我当前代码的小提琴.