JavaScript following scrolling effect plug-in code (JavaScript Follow Plugin)

Source: Internet
Author: User
This article describes the JavaScript following scrolling effect plug-in code (JavaScript Follow Plugin), and a friend in Need can refer to

Js following scrolling effect plugin
Support for defining multiple follow IDs, using CSS fixed attributes, not supporting IE6, and compatible with other mainstream browsers.
Support defines the minimum height of scrolling to the bottom and does not overwrite
When the page size is resize, the plug-in automatically resets the parameter
=======
Js following scrolling effect plugin
1. Support for defining multiple follow IDs, using CSS fixed properties, not supporting IE6, compatible with other mainstream browsers.
2. Support to define the minimum height of scrolling to the bottom, will not overwrite
3. After the page size resize, the plug-in will automatically reset the parameter
=======
How to use
The code is as follows

Copy Code code as follows:


<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


 });


}


 


Full instance
The code is as follows

Copy Code code as follows:




<! 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: "";d Isplay: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 class= "wrap" >


<div class= "header" >Header</div>


<div class= "content clear" >


<div class= "left" >


<div class= "text" >


Use method:<br/>


1. Loading plug-ins, after the page is loaded, window.onload = function () {}<br/>


2. Create an array of objects to follow, such as var followids = [document.getElementById ("Follow"), document.getElementById ("Follow2")];< Br/>


3. Initialize follow:new Follow ();<br/>


4. Reference, obj is an object array, bottom is the minimum height of the scroll block from the bottom <br/>


<hr/>


<pre style= "word-break:break-all;word-wrap:break-word;width:600px;" >


<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 class= "right" >


<div class= "Aside" id= "Follow" >


Follow scrolling <br/> Module 1


</div>


<div class= "Aside2" id= "Follow2" >


follow rolling <br/> Module 2


</div>


</div>


</div>


<div class= "Footer" >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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.