Using transform on two elements works fine in IE and Firefox but somehow "stutters" in Chrome.
I've captured the different behaviours with some gifs:
Example on jsfiddle
Is it possible to fix this behaviour in Chrome? I couldn't find anything when I searched.
Thanks for your help in advance :)
Here is some exemplary code.
HTML:
<div class="outer">
<div class="menu">
asdf
</div>
<div class="content">
<button id="trigger">toggle menu</button>
</div>
</div>
CSS:
.outer > div {
transition: transform 500ms ease, margin-right 500ms ease;
}
.menu {
background-color: #1d1f20;
top: 0;
left: -200px;
width: 200px;
position: fixed;
transform: translate(200px,0);
}
.content {
transform: translate(200px, 0px);
margin-right: 200px;
background: green;
}
JS:
var current = '200px';
$('#trigger').on('click', function() {
current = current === '200px' ? '0' : '200px';
$('.menu').css({transform: 'translate('+current+', 0)'});
$('.content').css({transform: 'translate('+current+', 0)', marginRight: current === '200px' ? '200px' : '0'});
});