<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{
100%;
height:80px;
background-color:#000;
margin-bottom:40px;<!--距离底部的距离-->
}
.fixedSubNav{
position:fixed;
top:0;
left:0;
z-index:1000;
}