Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to move <text> based on hour

ANSWERED

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'; }
Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Try just MYMINUTES.x. I've done something similar and that sort of thing worked for me.

Peter McLennan
Gondwana Software

View best answer in original post

Best Answer
2 REPLIES 2

Try just MYMINUTES.x. I've done something similar and that sort of thing worked for me.

Peter McLennan
Gondwana Software
Best Answer

That worked! Thank you 

Best Answer
0 Votes