Visitar URL original
Fixing startup · wesbos/JavaScript30@6f8ea2d · GitHub
Skip to content

Commit 6f8ea2d

Browse files
committed
Fixing startup
1 parent 1c1aca5 commit 6f8ea2d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎02 - JS + CSS Clock/index-START.html‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,18 @@
108108
const hour = now.getHours();
109109
const hourDegrees = 90 + (hour / 12)*360;
110110
hourHand.style.transform = `rotate(${hourDegrees}deg)`;
111-
}
112111

112+
if(!transitionEnabled){
113+
// Turn on transitions
114+
document.querySelectorAll(".hand").forEach(hand => hand.classList.add("tick-transition"));
115+
transitionEnabled = true;
116+
}
117+
118+
transitionEnabled = true;
119+
}
120+
let transitionEnabled = false;
113121
// Initially get everyone in place
114122
setDate();
115-
// Turn on transitions
116-
document.querySelectorAll(".hand").forEach(hand => hand.classList.add("tick-transition"));
117123
// Start ticking
118124
setInterval(setDate, 1000);
119125

0 commit comments

Comments
 (0)