猿问

"translate(-" + mbe * 600 + "px , 0)"这里为什么是数字有引号而字符没有了?大神help

function set() {
     setj = 1;
     mbe=1;
     img_box.style.transform = "translate(" + mbe * 600 + "px , 0)"
     var n = 0;

     function go() {
      n++;
      console.log(n);
      var setT = setTimeout(go, 1000);
      if(n === 3) {
       clearTimeout(setT);
       if(setj === 1) {
        img_box.style.transition = "0s";
        img_box.style.transform = "translate(-2400px,0)";
        if(mbe === 1) mbe = 4;
        n = 0;
        time=true;
       }
      }
     }
     go();
    }


qq_听一半的歌_1
浏览 1394回答 2
2回答

ExiaGo

object.style.transform="rotate(7deg)" 语法是这样。img_box.style.transform = "translate(" + mbe * 600 + "px , 0)" 这个应该没有问题吧,"translate(" 字符串,"px,0)" 字符串,中间的mbe*600 才是数字啊。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答