jquery 定时器 调用函数时传参
jquery 定时器 调用函数时传参
var li=$('.first>li:first-child');
var index=0;
var s=$('.first>li');
function gundong(a,b){
// console.log(b.length);
index++;
if(index>b.length-4){
index=0
}
a.animate({marginTop:-35*index+"px"});
}
var sto = setInterval;
window.setInterval = function(callback,timeout,param){
var args = Array.prototype.slice.call(arguments,2);
var _cb = function(){
callback.apply(null,args);
};
sto(_cb,timeout);
};
var first= setInterval(gundong,4000,li,s);