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

固定在網(wǎng)頁(yè)右側(cè)的浮動(dòng)層實(shí)現(xiàn)代碼

  發(fā)布時(shí)間:2014-04-23 15:31:42   作者:佚名   我要評(píng)論
說(shuō)到浮動(dòng)層,想必大家都有見(jiàn)到過(guò)吧,很熟悉,但是你知道它是怎么實(shí)現(xiàn)的呢?下面有個(gè)不錯(cuò)的示例為大家介紹下網(wǎng)頁(yè)右側(cè)的固定浮動(dòng)層具體實(shí)現(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>無(wú)標(biāo)題文檔</title>
<style type="text/css">
body
{
margin:0px;
padding:0px;
margin-top:60px;
margin-bottom:60px;
}
#div_nav_zone_right
{
position:absolute;
float:right;
z-index:3;
width:120px;
height:100px;
right:0px;
top: 332px;
background-color:#999;
}
#div_nav_zone_right_bottom
{
position:absolute;
float:right;
z-index:3;
width:120px;
height:100px;
right:0px;
top: 532px;
background-color:#CCC;
}
#div_ul
{
position:fixed;
height:50px;
}
ul,li
{
margin:0px;
}
li
{
list-style:none;
}
</style>
<script type="text/javascript" src="js/jquery.js" ></script>
<script type="text/javascript">
$(function()
{
moveDiv(); //頁(yè)面初始化執(zhí)行
$(window).scroll(function(){
moveDiv();
moveRightBottomDiv();
});
});
//右側(cè)居中
function moveDiv()
{
var scrollTop = $(document).scrollTop(); //滾動(dòng)條上端隱藏的高度
var clientHeight = $(window).height(); //網(wǎng)頁(yè)內(nèi)容區(qū)高度
//設(shè)置位置為
var hei = $("#div_nav_zone_right").css("height");
hei = hei.replace("px","");
var newPosY = scrollTop + (clientHeight-hei)/2;
$("#div_nav_zone_right").css("top",newPosY+"px");
}
//右側(cè)居下100像素
function moveRightBottomDiv()
{
var scrollTop = $(document).scrollTop(); //滾動(dòng)條上端隱藏的高度
var clientHeight = $(window).height(); //網(wǎng)頁(yè)內(nèi)容區(qū)高度
//設(shè)置位置為
var hei = $("#div_nav_zone_right_bottom").css("height");
hei = hei.replace("px","");
var newPosY = clientHeight + scrollTop - hei - 100;
$("#div_nav_zone_right_bottom").css("top",newPosY+"px");
}
</script>
</head>
<body>
1 <br/>2 <br/>3 <br/>4 <br/>5 <br/>6 <br/>7 <br/>8 <br/>9 <br/>10 <br/>
<p>sd</p>
<p>f</p>
<p> </p>
<p>ads</p>
<p>f</p>
<p>ads</p>
<p>
<input type="button" name="button" id="button" value="提交" onclick="clk()" />
</p>
<p>ad</p>
<p>sf AS
D
as
d
SA
D
</p>
<p> </p>
<p>ads</p>
<p>f</p>
<p>ads</p>
sad
SA
D
a
d
A
D
a

<div id="div_nav_zone_right" >
<ul>
<li>邊欄菜單1 </li>
<li>邊欄菜單2 </li>
<li>邊欄菜單3 </li>
<li>邊欄菜單4 </li>
</ul>
</div>

<div id="div_nav_zone_right_bottom" >
<ul>
<li>邊欄菜單1 </li>
<li>邊欄菜單2 </li>
<li>邊欄菜單3 </li>
<li>邊欄菜單4 </li>
</ul>
</div>
</body>
</html>

相關(guān)文章

最新評(píng)論