@@ -374,9 +374,15 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">
374
374
</ form >
375
375
376
376
< div id ="phenoAgeResult " class ="bioageform " data-aos ="fade " data-aos-duration ="700 " data-aos-delay ="400 ">
377
- < div style ="font-size: 1rem; color: #2c3e50; text-align: center; "> Your biological age is:</ div >
378
- < div style ="font-size: 2.5rem; color: #4CAF50; font-weight: bold; text-align: center; "> < span id ="animatedAge "> 0</ span > </ div >
379
- < div id ="yearsText " style ="font-size: 1rem; color: #2c3e50; text-align: center; "> years</ div >
377
+ < div id ="validAgeInput ">
378
+ < div style ="font-size: 1rem; color: #2c3e50; text-align: center; "> Your biological age is:</ div >
379
+ < div style ="font-size: 2.5rem; color: #4CAF50; font-weight: bold; text-align: center; "> < span id ="animatedAge "> 0</ span > </ div >
380
+ < div id ="yearsText " style ="font-size: 1rem; color: #2c3e50; text-align: center; "> years</ div >
381
+ </ div >
382
+ < div id ="ensureCorrectInputSuggestion " style ="display: none; font-size: 1rem; color: #8B0000; background-color: #FAD2D2; padding: 0.5rem; text-align: center; border-radius: 5px; margin-top: 10px; ">
383
+ The calculated result seems wrong. Double-check all your input values and units. If everything looks correct, drop everything and rush to a hospital NOW!!!
384
+ < i class ="fas fa-ambulance "> </ i > < i class ="fas fa-hospital "> </ i > < i class ="fas fa-clinic-medical "> </ i >
385
+ </ div >
380
386
</ div >
381
387
382
388
< div class ="options-container " data-aos ="fade " data-aos-duration ="700 " data-aos-delay ="400 ">
@@ -540,6 +546,20 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">
540
546
541
547
// Display the result
542
548
const resultElement = document . getElementById ( 'phenoAgeResult' ) ;
549
+ const ensureCorrectInputSuggestion = document . getElementById ( 'ensureCorrectInputSuggestion' ) ;
550
+ const validAgeInput = document . getElementById ( 'validAgeInput' ) ;
551
+
552
+ // Check if the result is not infinite
553
+ if ( ! isFinite ( phenoAge ) ) {
554
+ resultElement . style . opacity = 1 ; // Fade-in effect
555
+ ensureCorrectInputSuggestion . style . display = 'block' ;
556
+ validAgeInput . style . display = 'none' ;
557
+ return ;
558
+ }
559
+ else {
560
+ ensureCorrectInputSuggestion . style . display = 'none' ;
561
+ validAgeInput . style . display = 'block' ;
562
+ }
543
563
544
564
// Setting up the animated counter effect
545
565
let displayAge = 0 ;
0 commit comments