// To use multiple transform properties for one element, you have to add += to your next line. document.getElementById("myId").style.transform = "rotateX(" + x + "deg)"; document.getElementById("myId").style.transform += "rotateY(" + y + "deg)";