为什么不动?
function move(){
console.log(moveoffset+"out");
while(moveoffset<offsetX){
console.log(moveoffset+"moveoffsetWhileIn");
$('.move').style.left=moveoffset+"px";
setTimeout(function(){
moveoffset++;
},1000);
console.log(offsetX+"offsetX");
}
}
move()
答案 0 :(得分:1)
1。)未提供moveoffset
和offsetX
的值
2。)使用jQuery时,$('.move').css('prop', 'value')
是正确的方法
3。)在setTimeout
中,您正在递增moveoffset
,但您没有使用此递增值来更新left
属性