JavaScriptでページ遷移っぽいものを
transitionだけで行うなら
.normal { margin-left: 0px; -moz-transition: all 1s ease; -webkit-transition: all 1s ease; } .moved { margin-left: -300px; -moz-transition: all 1s ease; -webkit-transition: all 1s ease; }
として
<div style="width:300px; overflow:hidden;"> <div id="w" style="width:600px; display:flex; flex-direction:row; " class="normal"> <div style="width:300px; background-color:#FFEFEF;">ok1</div> <div style="width:300px; background-color:#EFFFFF;">ok2</div> </div> </div> <div onClick="document.getElementById('w').className='moved';">click</div> <div onClick="document.getElementById('w').className='normal';">back</div>
こんな感じかな