梅乌恩打刻板儿
2017-01-12 17:55
function startRun(options,runTime) { //恢复摆手 recoverWalk(); //运动属性 /* boy.transition( options, runTime, 'linear');*/ boy.css({ "transition":options+" "+runTime+" linear" }); } 为什么不能直接用boy.css()的方法,是我写错了吗。我不想再引入一个jquery插件,所以不想用老师那个方法。。这个要怎么改才能用
//开始走路
function walkRun(runTime,dist,distY) {
//如果time没有值就取3000
runTime = runTime || 3000;
//摆动脚步;
slowWalk();
//开始走路
//恢复走路摆动
recoverWalk();
//运动属性
boy.css({
"left":dist+"px",
"top":distY?distY:undefined,
"transition": runTime+"ms linear"
});
}
找到解决方法了,我将startRun合并到walkRun里了。
至于为什么这样写boy.css({"transition":options+" "+runTime+" linear"});不行,因为options是一个对象,它其实对应了原先老师walkRun里的{'left': dist + 'px', 'top': disY ? disY : undefined}
function startRun(options,runTime) {
//恢复摆手
recoverWalk();
//运动属性
/* boy.transition(
options,
runTime,
'linear');*/
boy.css({
"transition":options+" "+runTime+" linear"
});
}
注释掉的是老师的方法,下面是我写的,但是运行不了。请问是哪里错了
boy.css({
'transition-timing-function' : 'linear',
'transition-duration' : speed + 'ms',
'transform' : 'translate3d(-' + x + 'px,0px,0px)'
});
H5+JS+CSS3实现七夕言情
211516 学习 · 570 问题
相似问题