$.fn.changeList = function(options){
var defaults = {
tag : 'li', // 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('li'),
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; }
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号