Reputation:
In typescript how to change css styling just as I would do this way?
$(".s-hand").css("transform", "translate(-50%, -100%) rotate(" + s*6 + "deg)");
or
var hourPointer = document.querySelector('.hour')
hourPointer.style[transform] = `rotate(${hour}deg)`;
Because I have no idea how to achieve that..
Upvotes: 5
Views: 44987
Reputation:
It has to be done like this:
let shand = document.getElementsByClassName('s-hand') as HTMLCollectionOf<HTMLElement>;
if (shand.length != 0) {
shand[0].style.transform = "translate(-50%, -100%) rotate(" + s * 6 + "deg)";
}
Upvotes: 10