亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jquery簡單實現(xiàn)滾動條下拉DIV固定在頭部不動

 更新時間:2013年11月25日 17:05:49   作者:  
滾動條下拉DIV固定在頭部不動效果,想必很多的朋友都有見到過吧,下面為大家詳細介紹下使用jquery是如何實現(xiàn)的,感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>滾動條下拉DIV固定在頭部不動</title>
<script type="text/javascript" src="http://img.fishburg.net/ks/js/jquery-1.8.js"></script>
<style>
*{padding:0;margin:0;}
.ab{ width:100%; background-color:#eee; height:250px; text-align:center; line-height:250px;}
.bc{ width:100%; background-color:#eee; text-align:center; text-align:center; color:#fff; font-size:24px; background-color:#060;}
.pf{ width:100%; height:50px; background-color:#C00; text-align:center; line-height:50px; color:#fff;}

/*---------------------漂浮導(dǎo)航---------------------------*/
html{ _background-image:url(about:blank); _background-attachment:fixed;/** 防止 ie6 抖動 **/}
.float{ position:fixed; z-index:999999; top:0px;}
* html .float{ position:absolute; _top:expression(documentElement.scrollTop-0);}
</style>

</head>

<body>
<div class="ab">第一版塊</div>
<div class="pf">漂浮內(nèi)容</div>
<script type="text/javascript">
window.onscroll=function(){
if ($(document).scrollTop() > 250)
{
//$("#pf_nav").show();
$(".pf").addClass('float');
}else{
//$("#pf_nav").hide();
$(".pf").removeClass('float');
}
}
</script>
<div class="bc">
<p>
<script language="javascript">
for(i=0;i<50;i++){
document.write(i+"<br />");
}
</script>
</p>
</div>
</body>
</html>

相關(guān)文章

最新評論