jQuery实现页面向下滚动后显示隐藏导航条
展开全部
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>主页</title>
<style>
*{
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<div id="div" style="width: 100%;height: 30px;background-color: aqua;position: fixed;top: 0px;text-align: center;">导航栏</div>
<div style="width: 1000px;height: 3000px;background-color: gray;margin: auto;text-align: center;">主体</div>
<script>
window.onmousewheel = function () {
if(window.scrollY>100){
document.getElementById("div").style.display = "none";
}else
{
document.getElementById("div").style.display = "block";
}
}
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询