jQuery實(shí)現(xiàn)div浮動層跟隨頁面滾動效果
更新時(shí)間:2014年02月11日 10:18:49 作者:
這篇文章主要介紹了jQuery實(shí)現(xiàn)div浮動層跟隨頁面滾動效果,需要的朋友可以參考下
復(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" />
<meta name="keywords" content="滾動,漂浮層,php,jquery" />
<meta name="description" content="Helloweba演示平臺,演示XHTML、CSS、jquery、PHP案例和示例" />
<title>jQuery實(shí)現(xiàn)浮動層跟隨頁面滾動效果</title>
<link rel="stylesheet" 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 id="demo1" class="demo">
<img src="pic.jpg" align="" />
<h3>Demo 1</h3>
<p>滾動鼠標(biāo)滾輪或者拖動瀏覽器的滾動條看看。</p>
</div>
<div id="demo2" class="demo">
<img src="pic1.jpg" align="" />
<h3>Demo 2</h3>
<p>你可以通過點(diǎn)擊下面的鏈接來開啟和關(guān)閉浮動層的跟隨滾動效果。</p>
<p><a id="switchlink">啟動開關(guān)</a></p>
</div>
<div id="header">
<div id="logo"><h1><a title="返回helloweba首頁">helloweba</a></h1></div>
</div>
<div id="main">
<h2 class="top_title"><a >jQuery實(shí)現(xiàn)浮動層跟隨頁面滾動效果</a></h2>
</div>
<div id="footer">
<p>Powered by helloweba.com 允許轉(zhuǎn)載、修改和使用本站的DEMO,但請注明出處:<a >www.helloweba.com</a></p>
</div>
<p id="stat"><script type="text/javascript" src="http://js.#linezing.com/1870888/#js"></script></p>
</body>
</html>
相關(guān)文章
js實(shí)現(xiàn)文件上傳功能 后臺使用MultipartFile
這篇文章主要為大家詳細(xì)介紹了純js實(shí)現(xiàn)最簡單的文件上傳功能,后臺使用MultipartFile,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-09-09JS中間件設(shè)計(jì)模式的深入探討與實(shí)例分析
這篇文章主要介紹了JS中間件設(shè)計(jì)模式,結(jié)合實(shí)例形式分析了JS中間件設(shè)計(jì)模式功能、原理、應(yīng)用場景及相關(guān)操作注意事項(xiàng),需要的朋友可以參考下2020-04-04layer頁面跳轉(zhuǎn),獲取html子節(jié)點(diǎn)元素的值方法
今天小編就為大家分享一篇layer頁面跳轉(zhuǎn),獲取html子節(jié)點(diǎn)元素的值方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-09-09JavaScript實(shí)現(xiàn)打字效果的方法
這篇文章主要介紹了JavaScript實(shí)現(xiàn)打字效果的方法,可實(shí)現(xiàn)文字陸續(xù)出現(xiàn)的打字效果,涉及javascript時(shí)間函數(shù)及頁面元素獲取的相關(guān)技巧,需要的朋友可以參考下2015-07-07js 實(shí)現(xiàn) list轉(zhuǎn)換成tree的方法示例(數(shù)組到樹)
這篇文章主要介紹了js 實(shí)現(xiàn) list轉(zhuǎn)換成tree的方法示例(數(shù)組到樹),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08簡述ES6新增關(guān)鍵字let與var的區(qū)別
最近看了很多文章,偶然間看到ES6中新增了一個(gè)關(guān)鍵字 let ,它具有與 var 關(guān)鍵字相似的功能。接下來通過本文給大家介紹ES6新增關(guān)鍵字let與var的區(qū)別,需要的朋友可以參考下2019-08-08javascript的replace方法結(jié)合正則使用實(shí)例總結(jié)
這篇文章主要介紹了javascript的replace方法結(jié)合正則使用技巧,實(shí)例總結(jié)了replace方法配合正則表達(dá)式進(jìn)行變量、分組、字符等替換技巧,需要的朋友可以參考下2016-06-06JS實(shí)現(xiàn)鼠標(biāo)滑過鏈接改變網(wǎng)頁背景顏色的方法
這篇文章主要介紹了JS實(shí)現(xiàn)鼠標(biāo)滑過鏈接改變網(wǎng)頁背景顏色的方法,涉及js響應(yīng)鼠標(biāo)事件動態(tài)修改頁面元素屬性的實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-10-10