国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

javascript跟隨滾動效果插件代碼(javascript Follow Plugin)

2024-05-06 15:49:53
字體:
來源:轉載
供稿:網友
這篇文章介紹了javascript跟隨滾動效果插件代碼(javascript Follow Plugin),有需要的朋友可以參考一下

Js 跟隨滾動效果插件
支持定義多個跟隨ID,采用css fixed屬性,不支持ie6,兼容其他主流瀏覽器。
支持定義滾動到底部的最小高度,不會覆蓋底部
頁面大小resize后,插件會自動重置參數
=======
Js 跟隨滾動效果插件
1.支持定義多個跟隨ID,采用css fixed屬性,不支持ie6,兼容其他主流瀏覽器。
2.支持定義滾動到底部的最小高度,不會覆蓋底部
3.頁面大小resize后,插件會自動重置參數
=======
使用方法
 代碼如下
 

復制代碼 代碼如下:


 <script type="text/javascript" src="follow.js"></script>
window.onload = function(){
 var followIds = [document.getElementById("follow"),document.getElementById("follow2")];
 new Follow({
  obj:followIds,
  bottom:150
 });
}
 


 完整實例
 代碼如下
 

復制代碼 代碼如下:


 <!DOCTYPE html>
<html lang="zh-CN">
<head profile="http://gmpg.org/xfn/11">
<meta charset="UTF-8">
<title>Js Follow</title>
<style>
html,body{width:100%;margin:0;padding:0;}
div{padding:0;margin:0;text-align:center;font-size:40px;font-weight:bold;color:#fff;}
.clear:after{content:"";display:block;height:0;clear:both;visibility: hidden;overflow:hidden;}
.clear{*zoom:1;}
.wrap{width:1000px;margin:0 auto;}
.header{width:100%;background:#1BA1E2;height:200px;line-height:300px;}
.footer{width:100%;background:#666;height:150px;line-height:100px;}
.content{width:100%;margin:0 auto;background:#aaa;}
.left{width:70%;float:left;background:#8CBF26;}
.text{padding:50px;text-align:left;word-break:break-all;line-height:36px;font-size:16px;font-weight:normal;}
.right{width:30%;float:left;}
.aside{padding:10px 0px;margin-top:50px;background:#F09609;width:300px;height:150px;}
.aside2{padding:10px 0px;background:#DB4F33;}
</style>
</head>
<body>
 <div>
  <div>Header</div>
  <div>
   <div>
    <div>
    使用方法:<br/>
    1.載入插件,在頁面載入之后,window.onload = function(){}<br/>
    2.創建需要跟隨的對象的數組,比如 var followIds = [document.getElementById("follow"),document.getElementById("follow2")];<br/>
    3.初始化Follow:new Follow();<br/>
    4.傳參,obj是對象數組,bottom是滾動塊距離底部的最小的高度<br/>
    <hr/>
<pre>
<script type="text/javascript" src="follow.js"></script>
window.onload = function(){
 var followIds = [document.getElementById("follow"),document.getElementById("follow2")];
 new Follow({
  obj:followIds,
  bottom:150
 });
}
</pre>
    </div>
    <br/><br/><br/><br/><br/><br/><br/><br/><br/>
   </div>
   <div>
    <div>
     跟隨滾動<br/>模塊1
    </div>
    <div>
     跟隨滾動<br/>模塊2
    </div>
   </div>
  </div>
  <div>Footer</div>
 </div>
<script type="text/javascript" src="follow.min.js"></script>
<script>
window.onload = function(){
 var followIds = [document.getElementById("follow"),document.getElementById("follow2")];
 new Follow({
  obj:followIds,
  bottom:150
 });
}
</script>
</body>
</html>
 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 商城县| 泰州市| 林西县| 虎林市| 渝中区| 曲松县| 新安县| 舟山市| 镇坪县| 德州市| 钟山县| 潼关县| 威宁| 墨玉县| 灵丘县| 台北县| 名山县| 邵阳市| 安丘市| 嘉义市| 惠安县| 池州市| 卫辉市| 珠海市| 寿阳县| 邻水| 阜新| 高邑县| 高邮市| 潜江市| 高阳县| 黄平县| 安泽县| 耿马| 宿松县| 温泉县| 丽水市| 望谟县| 昌平区| 盱眙县| 安丘市|