码迷,mamicode.com
首页 > Web开发 > 详细

顶部固顶导航菜单代码css+js

时间:2017-10-05 23:12:39      阅读:330      评论:0      收藏:0      [点我收藏+]

标签:sub   window   width   type   javascrip   function   class   z-index   底部   

<head>

<link href="css/inside.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
</head>
<body>

<div id="subNav">

/

/

/

</div>
<script>
$(window).scroll(function(){
$("#subNav").addClass("fixedSubNav");
});
</script>

</body>

<----------------------------------------------------------------->

inside.css:


#subNav{
width:100%;
height:80px;
background-color:#000;
margin-bottom:40px;<!--距离底部的距离-->
}

.fixedSubNav{
position:fixed;
top:0;
left:0;
z-index:1000;
}

顶部固顶导航菜单代码css+js

标签:sub   window   width   type   javascrip   function   class   z-index   底部   

原文地址:http://www.cnblogs.com/puzhichao/p/7630179.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!