140
140
transform : rotate (180deg );
141
141
}
142
142
143
+ /* Scroll to Top Button Styles */
144
+ .scroll-to-top {
145
+ position : fixed;
146
+ bottom : 100px ;
147
+ right : 20px ;
148
+ width : 60px ;
149
+ height : 60px ;
150
+ background : linear-gradient (135deg , # 667eea 0% , # 764ba2 100% );
151
+ color : white;
152
+ border : none;
153
+ border-radius : 50% ;
154
+ cursor : pointer;
155
+ display : none;
156
+ align-items : center;
157
+ justify-content : center;
158
+ font-size : 1.5em ;
159
+ box-shadow : 0 5px 15px rgba (102 , 126 , 234 , 0.3 );
160
+ transition : all 0.3s ease;
161
+ z-index : 1000 ;
162
+ animation : pulse 2s infinite;
163
+ }
164
+
165
+ .scroll-to-top : hover {
166
+ transform : scale (1.1 ) translateY (-3px );
167
+ box-shadow : 0 8px 25px rgba (102 , 126 , 234 , 0.4 );
168
+ background : linear-gradient (135deg , # 5a67d8 0% , # 6b46c1 100% );
169
+ }
170
+
171
+ .scroll-to-top : active {
172
+ transform : scale (0.95 );
173
+ }
174
+
175
+ .scroll-to-top .show {
176
+ display : flex;
177
+ animation : slideInFromRight 0.5s ease-out;
178
+ }
179
+
180
+ @keyframes slideInFromRight {
181
+ from {
182
+ opacity : 0 ;
183
+ transform : translateX (100px );
184
+ }
185
+ to {
186
+ opacity : 1 ;
187
+ transform : translateX (0 );
188
+ }
189
+ }
190
+
191
+ @keyframes pulse {
192
+ 0% , 100% {
193
+ box-shadow : 0 5px 15px rgba (102 , 126 , 234 , 0.3 );
194
+ }
195
+ 50% {
196
+ box-shadow : 0 5px 20px rgba (102 , 126 , 234 , 0.5 );
197
+ }
198
+ }
199
+
200
+ /* Responsive adjustments for scroll to top button */
201
+ @media (max-width : 768px ) {
202
+ .scroll-to-top {
203
+ bottom : 120px ;
204
+ right : 15px ;
205
+ width : 50px ;
206
+ height : 50px ;
207
+ font-size : 1.2em ;
208
+ }
209
+ }
210
+
143
211
/* Footer */
144
212
footer {
145
213
background : linear-gradient (135deg , # 3b56d0 0% , # 630eb7 100% );
@@ -228,6 +296,11 @@ <h1>FAQ</h1>
228
296
</ div >
229
297
</ div >
230
298
299
+ <!-- Scroll to Top Button -->
300
+ < button id ="scrollToTopBtn " class ="scroll-to-top " onclick ="scrollToTop() " title ="Go to top ">
301
+ < i class ="fas fa-chevron-up "> </ i >
302
+ </ button >
303
+
231
304
< footer >
232
305
< div class ="footer-content ">
233
306
< p > © 2025 NeoRide - Your Safety First</ p >
@@ -249,6 +322,34 @@ <h1>FAQ</h1>
249
322
faq . classList . toggle ( "active" ) ;
250
323
} ) ;
251
324
} ) ;
325
+
326
+ // Scroll to Top Button functionality
327
+ const scrollToTopBtn = document . getElementById ( 'scrollToTopBtn' ) ;
328
+
329
+ // Show/hide button based on scroll position
330
+ window . addEventListener ( 'scroll' , function ( ) {
331
+ if ( window . pageYOffset > 300 ) { // Show button after scrolling 300px
332
+ scrollToTopBtn . classList . add ( 'show' ) ;
333
+ } else {
334
+ scrollToTopBtn . classList . remove ( 'show' ) ;
335
+ }
336
+ } ) ;
337
+
338
+ // Smooth scroll to top function
339
+ function scrollToTop ( ) {
340
+ window . scrollTo ( {
341
+ top : 0 ,
342
+ behavior : 'smooth'
343
+ } ) ;
344
+ }
345
+
346
+ // Add keyboard accessibility for scroll to top button
347
+ scrollToTopBtn . addEventListener ( 'keydown' , function ( e ) {
348
+ if ( e . key === 'Enter' || e . key === ' ' ) {
349
+ e . preventDefault ( ) ;
350
+ scrollToTop ( ) ;
351
+ }
352
+ } ) ;
252
353
</ script >
253
354
254
355
</ body >
0 commit comments