Home >Web Front-end >JS Tutorial >javascript follow scrolling effect plug-in code (javascript Follow Plugin)_javascript skills

javascript follow scrolling effect plug-in code (javascript Follow Plugin)_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:27:011154browse

Js follow scrolling effect plug-in
supports defining multiple follow IDs, uses css fixed attributes, does not support ie6, and is compatible with other mainstream browsers.
Supports defining the minimum height for scrolling to the bottom without covering the bottom
After the page size is resized, the plug-in will automatically reset the parameters
========
Js follow scrolling effect plug-in
1. Supports defining multiple follower IDs, using css fixed attributes, not supporting ie6, and compatible with other mainstream browsers.
2. Supports defining the minimum height for scrolling to the bottom without covering the bottom
3. After the page size is resized, the plug-in will automatically reset the parameters
========
How to use
The code is as follows

Copy the code The code is as follows:


window.onload = function(){
var followIds = [document.getElementById("follow"),document.getElementById("follow2" )];
new Follow({
obj:followIds,
bottom:150
});
}

Complete example
The code is as follows
Copy code The code is as follows:

 



Js Follow



 

 
Header

 

  

   

    使用方法:

    1.载入插件,在页面载入之后,window.onload = function(){}

    2.创建需要跟随的对象的数组,比如 var followIds = [document.getElementById("follow"),document.getElementById("follow2")];

    3.初始化Follow:new Follow();

    4.传参,obj是对象数组,bottom是滚动块距离底部的最小的高度

   

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

   

   









  

  

   

     跟随滚动
模块1
   

   

     跟随滚动
模块2
   

  

 

 
 


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


 
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn