File tree Expand file tree Collapse file tree 3 files changed +105
-8
lines changed
Expand file tree Collapse file tree 3 files changed +105
-8
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ function setAlarm() {
2121
2222 if ( seconds <= 0 ) {
2323 clearInterval ( countdown ) ;
24+ document . body . classList . add ( "alarm-finished" )
2425 playAlarm ( ) ;
2526 }
2627 } , 1000 ) ;
@@ -43,6 +44,7 @@ function playAlarm() {
4344function pauseAlarm ( ) {
4445 clearInterval ( countdown ) ;
4546 audio . pause ( ) ;
47+ document . body . classList . remove ( "alarm-finished" )
4648}
4749
4850window . onload = setup ;
Original file line number Diff line number Diff line change @@ -12,9 +12,11 @@ <h1 id="timeRemaining">Time Remaining: 00:00</h1>
1212 < label for ="alarmSet "> Set time to:</ label >
1313 < input id ="alarmSet " type ="number " />
1414
15+ < div class ="button-group ">
1516 < button id ="set " type ="button "> Set Alarm</ button >
1617 < button id ="stop " type ="button "> Stop Alarm</ button >
1718 </ div >
19+ </ div >
1820 < script src ="alarmclock.js "> </ script >
1921 </ body >
2022</ html >
Original file line number Diff line number Diff line change 1+ * {
2+ box-sizing : border-box;
3+ }
4+
5+ body {
6+ margin : 0 ;
7+ font-family : Arial, sans-serif;
8+ min-height : 100vh ;
9+ display : flex;
10+ justify-content : center;
11+ align-items : center;
12+ background : linear-gradient (90deg , # fcff9e 0% , # c67700 100% );
13+ transition : background 0.4s ease;
14+ }
15+
16+ .alarm-finished {
17+ background : linear-gradient (90deg , # FC466B 0% , # 3F5EFB 100% );
18+ animation : flashBg 0.6s infinite alternate;
19+ }
20+ @keyframes flashBg {
21+ 0% {
22+ background : linear-gradient (90deg , # FC466B 0% , # 3F5EFB 100% );
23+ }
24+ 100% {
25+ background : linear-gradient (90deg , # fcff9e 0% , # c67700 100% );
26+ }
27+ }
28+
129.centre {
2- position : fixed;
3- top : 50% ;
4- left : 50% ;
5- -webkit-transform : translate (-50% , -50% );
6- transform : translate (-50% , -50% );
30+ width : 360px ;
31+ padding : 26px ;
32+ background : # ffffff ;
33+ border-radius : 20px ;
34+ box-shadow : 0 10px 25px rgba (0 , 0 , 0 , 0.2 );
35+ text-align : center;
36+ }
37+
38+ label {
39+ display : block;
40+ margin-bottom : 10px ;
41+ font-size : 15px ;
42+ color : # 555 ;
43+ }
44+
45+ # timeRemaining {
46+ margin : 0 0 22px ;
47+ font-size : 30px ;
48+ font-weight : bold;
49+ color : # 333 ;
50+ }
51+
52+ label {
53+ display : block;
54+ margin-bottom : 10px ;
55+ font-size : 15px ;
56+ color : # 555 ;
757}
858
959# alarmSet {
10- margin : 20px ;
60+ width : 100% ;
61+ padding : 12px ;
62+ font-size : 16px ;
63+ border : 2px solid # ddd ;
64+ border-radius : 12px ;
65+ outline : none;
66+ margin-bottom : 18px ;
67+ transition : 0.2s ;
1168}
1269
13- h1 {
14- text-align : center;
70+ # alarmSet : focus {
71+ border-color : # 667eea ;
72+ box-shadow : 0 0 6px rgba (102 , 126 , 234 , 0.4 );
73+ }
74+
75+ .button-group {
76+ display : flex;
77+ gap : 12px ;
78+ }
79+
80+ button {
81+ flex : 1 ;
82+ padding : 12px ;
83+ font-size : 15px ;
84+ border : none;
85+ border-radius : 12px ;
86+ cursor : pointer;
87+ color : white;
88+ font-weight : bold;
89+ transition : transform 0.15s ease, box-shadow 0.15s ease;
90+ }
91+
92+ # set {
93+ background : # 4CAF50 ;
94+ }
95+
96+ # set : hover {
97+ background : # 43a047 ;
98+ transform : translateY (-2px );
99+ }
100+
101+ # stop {
102+ background : # f44336 ;
103+ }
104+
105+ # stop : hover {
106+ background : # e53935 ;
107+ transform : translateY (-2px );
15108}
You can’t perform that action at this time.
0 commit comments