网页制作中滚动到一定程度固定div
1、打开adobe dreamweaver,新建html文档。

2、书写html代码。<div class="top clear" style="background:red">顶部固定</div>

3、引用jquery-1.10.2.min.js<script src="js/jquery-1.10.2.min.js&鳎溻趄酃quot; charset="UTF-8"></script>

4、书写滚动之后的固定顶部样式<style>.fixednav{ _position:relative; _top:81px; /* position fixed for I呶蓟鹭毵E6 */ _position:absolute; _top:expression(documentElement.scrollTop + "px"); position:fixed; top:81px;}</style>

5、书写滚动事件<script type="text/javascript">$(function(){var nav=$(".top"); //得到导航对象var win=$(window); //得到窗口对象var sc=$(document);//得到document文档对象。win.scroll(function(){ if(sc.scrollTop()>=120){ nav.addClass("fixednav"); $(".navTmp").fadeIn(); }else{ nav.removeClass("fixednav"); $(".navTmp").fadeOut(); }})})</script>
