復制代碼 代碼如下:
<!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" />
<meta content="滾動,漂浮層,php,jquery" />
<meta content="Helloweba演示平臺,演示XHTML、CSS、jquery、PHP案例和示例" />
<title>jQuery實現浮動層跟隨頁面滾動效果</title>
<link type="text/css" href="../css/main.css" />
<style type="text/css">
#main{height:2000px}
.demo{width:180px; height:250px; margin:10px; border:2px solid #ccc; background:#eee; padding:10px; }
#demo1{position:relative; margin-top:-290px;}
#demo2{position:absolute; margin-top:156px; right:10px;}
.demo a{text-decoration:underline; cursor:pointer}
.demo h3{font-size:14px}
.demo p{line-height:20px}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<script type="text/javascript" src="jquery.scroll-follow.js"></script>
<script type="text/javascript">
$(function(){
$("#demo1").scrollFollow({
offset: 156
});
$("#demo2").scrollFollow({
speed:1000,
//offset: 156,
//relativeTo:"bottom",
killSwitch: "switchlink",
onText: '取消滾動',
offText: '開啟滾動'
});
});
</script>
</head>
<body>
<div>
<img src="pic.jpg" />
<h3>Demo 1</h3>
<p>滾動鼠標滾輪或者拖動瀏覽器的滾動條看看。</p>
</div>
<div>
<img src="pic1.jpg" />
<h3>Demo 2</h3>
<p>你可以通過點擊下面的鏈接來開啟和關閉浮動層的跟隨滾動效果。</p>
<p><a>啟動開關</a></p>
</div>
<div>
<div><h1><a src="http://js.tongji.linezing.com/1870888/tongji.js"></script></p>
</body>
</html>
新聞熱點
疑難解答
圖片精選