Jquery implements image paging. You can use the following method:
The Code is as follows:
$ (Function ($ ){
$. Fn. changeList = function (options ){
Var defaults = {
Tag: 'lil', // tab name
SubName: '. utilTabSub', // sub class name
EventType: 'click', // event type
Num: 4,
ShowType: 'Show '// show effect type
},
Opts = $. extend ({}, defaults, options ),
That = $ (this ),
SubUl = that. find (opts. subName ),
SubItems = subUl. find ('lil '),
Size = subItems. length,
LiW = subItems. outerWidth (true ),
UlW = liW * size,
Page = size + 1,
N = opts. num,
RandNum = 0,
M = 0;
If (size> n ){
That. find (opts. tag) [opts. eventType] (function (){
RandNum = mathRand (n, size );
SubItems. hide ();
$. Each (randNum, function (I, el ){
SubItems. eq (el). fadeIn (800 );
});
});
}
};
} (JQuery ));
/**
* Create Random number
* @ Param bit: number
* @ Param max: max number
* @ Return {Array}
*/
Function mathRand (bit, max ){
Var num = 0,
Arr = [],
Ret = [];
For (var I = 0; I
Num = Math. floor (Math. random () * max );
If ($. inArray (num, ret) =-1 ){
Ret. push (num );
} Else {
I --;
Continue;
}
}
Return ret;
}