stackoverflow moving block

by pablodarde

HTML

<div class="movingBox"></div>

CSS

.movingBox {
  width: 100px;
  height: 40px;
  background: #999;
  transform: translate3d(0,0,0);
  transition: all 0.5s;
}

.moving {
  transform: translate3d(200px,0,0);
  background: #f00;
}

Babel + JSX

const box = document.getElementsByClassName('movingBox')[0];
    
    console.log(box.className);
    
    setTimeout(() => {
    	box.className += ' moving';
    }, 1000);