I've created an element (used as a header) and a transition property on this element for TranslateX(). The transition is activated when I change the element's height. Here is the codePen for the scenario: Transition on translateX
CSS
.header {
position: fixed;
top: 0;
height: 100px;
background-color: black;
transition: translateX() 0;
transition-duration: 1s;
width: 100%;
}
JS
function() {
var currentScrollPos = window.pageYOffset;
if (prevScrollpos > currentScrollPos) {
document.querySelector(".header").style.height = "100px";
} else {
document.querySelector(".header").style.height = "50px";
}
prevScrollpos = currentScrollPos;
}
Why is transition activated on height change?
I saw that transform-origin's value is changing when I change the element's height. Is transform-origin activating translateX?