Jquery _ jquery

Source: Internet
Author: User
This article mainly introduces jquery's method for implementing the tumble display effect of page blinds. The example analyzes the implementation skills of jQuery's operation of the tumble effect, which has some reference value, for more information, see the examples in this article. Share it with you for your reference. The details are as follows:

1. the code here requires support from jquery1.3 and above, as shown below:

The code is as follows:

JQuery. fn. extend ((
Function ($ ){
Var l = 4, // Number of rolling rows
T = 5000, // The interval after the rolling starts the next time
Rt = 500, // The time consumed by each n-volume previous operations
N = "li", // The HTML tag to be rolled in the default volume object
O = "ul", // The HTML tag of the wrapped volume element that is enabled when the scroll is enabled
E, // call object
En, // call all the sets of objects to be rolled
H; // scroll row height
Var vLimit = 80; // smaller than the visual limit of 0.1s
Var maxRnum = Math. ceil (rt/vLimit); // maximum number of scrolling times
Var maxRh = 0; // The height of each scroll
Var fnRollFirst = function (arg) {// roll arg to 1 n, and then 1st n to the last position.
Var rCount = 0; // record of the number of rolling operations
Var rVal = setInterval (function () {// Loops every vLimit, maxRnum-1 times in total
RCount ++;
Arg. scrollTop (arg. scrollTop () + maxRh );
If (rCount> = (maxRnum-1) {// small volume 1 time
ClearInterval (rVal );
Arg. scrollTop (arg. scrollTop () + h-maxRh * (maxRnum-1); // The Last modified volume value
// Move the first element to the end
Var nowN = arg. children (n );
NowN. eq (nowN. length-1). after (nowN. eq (0 ));
// After the first position is left blank, it must be corrected by inverted volume.
Arg. scrollTop (-h );
};
}, VLimit );
};
Var fnRollArr = function (arg) {// One-by-one volume of objects in the array
Var out = setInterval (function (){
FnRollFirst (arg. shift ());
If (! Arg. length ){
ClearInterval (out );
};
}, Rt );
};
Var fnRoll = function () {// Obtain the set of objects to be rolled one by one
Var arr = new Array ();
E. children (o). each (function (){
Var rn = $ (this). children (n );
If (rn. length> 1 ){
Arr. push ($ (this ));
};
});
SetInterval (function (){
FnRollArr (arr. slice (0 ));
}, T );
};
Var fnLay = function () {// layout page
H = en. height ();
Var nu = Math. ceil (en. length/l );
Var u = $ ("<" + o + "> ");
U.css ({"overflow": "hidden", "height": h + "px", "margin-bottom": "15px "});
For (var I = 0; I
En. slice (nu * I, nu * (I + 1). wrapAll (u );
};
};
Var fnMain = function () {// method of rolling master
If (maxRnum> 1 ){
FnLay ();
MaxRh = Math. ceil (h/maxRnum );
FnRoll ();
};
};
Var fnStart = function (arg) {// initialize the display mode
E = arg;
En = e. children (n );
En. show ();
If (en. length> l ){
FnMain ();
} Else {
Return false;
};
};
Return {
SetLine: function (num) {// you can specify the number of rows to be merged.
(! IsNaN (num) & num> 0 )? L = num :"";
Return this;
},
SetTime: function (num) {// rolling interval: millisecond
(! IsNaN (num) & num> 0 )? T = num :"";
Return this;
},
StartRoll: function () {// start the volume
FnStart (this );
}
};
}
) (JQuery ));


2. the page can be like this

The code is as follows:



  • Li Fei is applying to become an experienced expert


  • Li Fei has contributed to the workplace topic "I am a person from Asia Pacific and Asia Pacific"


  • Dong Chuanmin has successfully purchased the workplace topic "I am a person from Asia Pacific and Asia Pacific"


  • Li Fei once again sold the solution "I am a person from Asia Pacific and Asia Pacific"


  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?





  • Li Fei submitted his contribution to the workplace topic "I am a person from Asia Pacific and Asia Pacific", which has been approved and won a 1 yuan reward.


  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio's review experience:

    Life perception and handling skills life perception and handling




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?





  • Li Fei has become an experienced expert


  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio's review experience:

    Life perception and handling skills life perception and handling




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?





  • Li Fei has invited Dong Chuanmin to become an experienced expert


  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio's review experience:

    Life perception and handling skills life perception and handling




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • Sannerio answered Dafei's question

    Life perception and handling skills life perception?




  • 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.