Hello,
I'm trying to move the text tag horizontally to the left based on the hour value. The style.x javascript method does not appear to work. Do you have any other solutions please?
<svg class="background"> <text id="myHour" /> <text id="myMinutes" /> </svg>
const MYMINUTES = document.getElementById("myMinutes");
if (preferences.clockDisplay === "12h") {
// 12h format
hours = hours % 12 || 12;
} else {
// 24h format
hours = util.zeroPad(hours);
}
//Readjust min position based on hour
if (hours < 10) {
MYMINUTES.style.x='30%+10';
} else {
MYMINUTES.style.x='50%+10';
}
Answered! Go to the Best Answer.
Best Answer