Using css3 translate instead of position: left


Why Moving Elements With Translate() Is Better Than Pos:abs Top/left Reference article Paul Irish

For the life of me, I cannot get this css3 translate animation to work. So I made a jquery interaction that has the same to behavior. click on the X .navi-toggle in the top left corner to see it in action. It's rather jerky and I'm really curious on how much better translate() will work.



<div id="page-container"> 
  <nav id="route-bar" >
  <div class="w-panel">
      <div class="navi-toggle">X</div>
      <div class="panel">
  </div><!--end of w-panel-->
</div><!--end of page container-->





  click: ->
    $(".w-panel").toggleClass "open-panel"
Problem courtesy of: Matthew Harwood


Hopefully this gets you a bit closer. Based on your CodePen example you really just need to animate the width, which could be done using keyframes or possibly a transition.


.open-panel {
    -webkit-animation-duration: 2s;
    -webkit-animation-name: slideOver;

@-webkit-keyframes slideOver {
    from {
    to {

Here's the full jsFiddle (apologies on the -webkit prefix, hopefully this gets you started).

Solution courtesy of: Brett DeWoody


I have no idea about translate but you can use margin instead.

Discussion courtesy of: Rahul Makhija

This recipe can be found in it's original form on Stack Over Flow.