<div id="container">
<div id="fixed">This is fixed</div>
</div>
<button id="foo">Add "transform:translateZ(0)" to container</button>
#container {
background: lightgray;
width: 200px;
height: 200px;
/* transform: translateZ(0); */
}
#fixed {
background: darkgray;
position: fixed;
bottom: 0;
right: 0;
}
button {
margin-top: 30px;
}
document.getElementById('foo').onclick = function(){
document.getElementById('container').style.transform = 'translateZ(0)';
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.