js/jquery:定时器中函数不能传参的解决方法
var num = 0;function slideRun(x){ scrollImg.animate({top:- h * x + "px"},{duration:500,queue:false}); $(".slideNumber span").removeClass("on").eq(num).addClass("on"); num++; } var timer = setInterval(function(){slideRun(num)}, 500); // 要给函数用闭包的形势