js代码是否有问题没有效果
var imgUrl = 'a.jpg';
var positions = ['0 -184','0 -276','0 -368','0 -460' ];
var ele=document.getElementById("boy");
animation(ele,positions,imgUrl);
function animation(ele,positions,imgUrl){
ele.style.backgroundImage='url('+imgUrl+')';
ele.style.backgroundRepeat='no-repeat';
var index = 0;
function run (){
var positions=positions[index].split('');
ele.style.backgroundPosition=positions[0]+'px'+positions[1]+'px';
index++;
if(index>=positions.length){
index=0;
}
setTimeout(run,80);
}
run();
}