From 03e484de5fa2e028d1f39aa5c5e929663f631175 Mon Sep 17 00:00:00 2001 From: Phoenix-03 <124414009+Phoenix-03@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:54:00 +0530 Subject: [PATCH 1/3] Update index.html --- Calculators/BMI-Calculator/index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Calculators/BMI-Calculator/index.html b/Calculators/BMI-Calculator/index.html index 3d69ac749..848df6846 100644 --- a/Calculators/BMI-Calculator/index.html +++ b/Calculators/BMI-Calculator/index.html @@ -33,14 +33,16 @@

BMI Calculator

- + +
+ Convert to ft
- +
-
+
@@ -56,7 +58,7 @@

BMI Calculator

- + - \ No newline at end of file + From 2c2662be1411ffd95155ef36c74c2d67eb60c52f Mon Sep 17 00:00:00 2001 From: Phoenix-03 <124414009+Phoenix-03@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:54:26 +0530 Subject: [PATCH 2/3] Update script.js --- Calculators/BMI-Calculator/script.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Calculators/BMI-Calculator/script.js b/Calculators/BMI-Calculator/script.js index b638f58af..200534130 100644 --- a/Calculators/BMI-Calculator/script.js +++ b/Calculators/BMI-Calculator/script.js @@ -11,8 +11,21 @@ modalText = document.querySelector("#modalText"); var modal = document.getElementById("myModal"); var span = document.getElementsByClassName("close")[0]; -// Remove the initial setting of the result -// document.querySelector("#result").innerHTML = "00.00"; +// Event listener for the "Convert to ft" link +document.getElementById('convertToFt').addEventListener('click', function (e) { + e.preventDefault(); // Prevent the link from actually navigating + + let heightCm = height.value; + + if (heightCm) { + let heightFt = (heightCm / 30.48).toFixed(2); // Convert cm to feet + height.value = heightFt; // Set the value to feet + document.querySelector('.inputH label').innerHTML = 'Height (ft)'; // Change label to ft + alert(`Your height is ${heightFt} feet`); + } else { + alert('Please enter your height in cm first.'); + } +}); function calculate() { if (age.value == '' || height.value == '' || weight.value == '' || (male.checked == false && female.checked == false)) { @@ -25,9 +38,11 @@ function calculate() { countBmi(); } } + function isPositiveNumber(value) { return /^\d*\.?\d+$/.test(value) && parseFloat(value) > 0; } + function countBmi() { var p = [age.value, height.value, weight.value]; if (male.checked) { @@ -60,7 +75,6 @@ function countBmi() { resultArea.style.display = "block"; document.querySelector(".comment").innerHTML = `You are ${result}`; - // Update the result only after the calculation document.querySelector("#result").innerHTML = bmi.toFixed(2); } From 91238e63895772685f5fd9974fb5fd2c3b06b948 Mon Sep 17 00:00:00 2001 From: Phoenix-03 <124414009+Phoenix-03@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:54:50 +0530 Subject: [PATCH 3/3] Update style.css --- Calculators/BMI-Calculator/style.css | 353 ++++++++++++++++++++++++++- 1 file changed, 352 insertions(+), 1 deletion(-) diff --git a/Calculators/BMI-Calculator/style.css b/Calculators/BMI-Calculator/style.css index e1618ed15..912edf367 100644 --- a/Calculators/BMI-Calculator/style.css +++ b/Calculators/BMI-Calculator/style.css @@ -60,6 +60,355 @@ h1 { font-family: "Nunito", sans-serif; } +.inputW { + background: #fff; + box-shadow: 0px 0px 95px -30px rgba(0, 0, 0, 0.15); + border-radius: 12px; + padding: 20px 0; + margin-bottom: 20px; +} + +.inputW label { + display: block; + font-size: 18px; + font-weight: 600; + color: #000; + margin-bottom: 20px; +} + +.inputW input { + outline: none; + border: none; + border-bottom: 1px solid #4f7df9; + width: 50%; + text-align: center; + font-size: 28px; + font-family: "Nunito", sans-serif; +} + +.inputH { + background: #fff; + box-shadow: 0px 0px 95px -30px rgba(0, 0, 0, 0.15); + border-radius: 12px; + padding: 10px 0; + margin-bottom: 20px; + margin-right: 20px; +} + +.inputH label { + display: block; + font-size: 18px; + font-weight: 600; + color: #000; + margin-bottom: 20px; +} + +.inputH input { + outline: none; + border: none; + border-bottom: 1px solid #4f7df9; + width: 50%; + text-align: center; + font-size: 28px; + font-family: "Nunito", sans-serif; +} + +button.calculate { + cursor: pointer; + font-family: "Nunito", sans-serif; + color: #fff; + background: rgb(97, 138, 254, 1); + font-size: 16px; + border-radius: 7px; + padding: 12px 0; + width: 100%; + outline: none; + border: none; + transition: all 0.5s; +} + +button.calculate:hover { + background: #0044ff; +} + +.result { + padding: 10px 20px; +} + +.result p { + font-weight: 600; + font-size: 22px; + color: #000; + margin-bottom: 15px; +} + +.result #result { + font-size: 36px; + font-weight: 900; + color: #4f7df9; + background-color: #eaeaea; + display: inline-block; + padding: 7px 20px; + border-radius: 55px; + margin-bottom: 25px; + min-height: 50px; + min-width: 130px; +} + +#comment { + color: #4f7df9; + font-weight: 800; +} + +.comment { + display: none; + border: dashed 1px; + border-radius: 7px; + padding: 5px; +} + +.gender { + display: flex; + justify-content: space-around; + align-items: center; + align-content: center; + background: #fff; + box-shadow: 0px 0px 95px -30px rgba(0, 0, 0, 0.15); + border-radius: 12px; + padding: 20px 0; + margin-bottom: 20px; +} + +.gender .container { + display: block; + position: relative; + padding-left: 35px; + margin-top: 7px; + cursor: pointer; + font-size: 22px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.gender .container input { + position: absolute; + opacity: 0; + cursor: pointer; +} + +.checkmark { + position: absolute; + top: 0; + left: 0; + height: 25px; + width: 25px; + background-color: #eee; + border-radius: 50%; +} + +.gender .container:hover input~.checkmark { + background-color: #ccc; +} + +.gender .container input:checked~.checkmark { + background-color: #2196f3; +} + +.checkmark:after { + content: ""; + position: absolute; + display: none; +} + +.gender .container input:checked~.checkmark:after { + display: block; +} + +.checkmark:after { + top: 9px; + left: 9px; + width: 8px; + height: 8px; + border-radius: 50%; + background: white; +} + +.containerHW { + display: flex; + justify-content: space-around; + align-items: center; +} + +.modal { + display: none; + position: fixed; + z-index: 1; + padding-top: 100px; + left: 0; + top: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.4); + padding-top: 300px; +} + +.modal-content { + background-color: #fefefe; + margin: auto; + padding-right: 20px; + border: 1px solid #888; + width: 600px; + box-shadow: #393c76 1px 2px 2px 1px; + position: relative; + padding: 30px; +} + +#modalText { + padding-top: 8px; + padding-right: 5px; + font-size: 18px; + font-family: 'Poppins', sans-serif; + color: rgb(24, 23, 23); +} + +.modal-wrong { + border: 2px solid red; +} + +.modal-correct { + border: 2px solid green; +} + +.close { + position: absolute; + color: #aaaaaa; + font-size: 28px; + font-weight: bold; + cursor: pointer; + transition: all 0.3s; + right: 25px; +} + +.close:hover { + color: #d41111; +} + +.linkDownload { + position: fixed; + background-color: #d12322; + margin: 20px; + padding: 10px 10px; + left: -0px; + border-radius: 5px; + bottom: -0px; + font-size: 16px; + font-weight: 400; + color: #fff; + text-decoration: none; + text-transform: capitalize; + transition: all 0.43s ease-in-out; +} + +.linkDownload { + padding-left: 7px; +} + +.linkDownload:hover { + text-decoration: none; + background: black; +} + +@media (max-width: 700px) { + .box { + width: 380px; + } + + .input label { + font-size: 18px; + } + + .inputH label, + .inputW label { + font-size: 14px; + } + + .input input, + .inputH input, + .inputW input { + font-size: 24px; + } + + .modal-content { + width: 380px; + } + + .linkDownload { + display: none; + } +@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap'); + +* { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: "Poppins", sans-serif; +} + +body { + display: flex; + align-items: center; + justify-content: center; + min-height: 100vh; + background: rgb(97, 138, 254, 0.9); +} + +.box { + width: 500px; + background: #fafafa; + border-radius: 12px; + text-align: center; + box-shadow: 2px 2px 20px 5px rgba(0, 0, 0, 0.5); +} + +h1 { + color: rgba(0, 0, 0, 0.7); + font-weight: bold; + font-size: 36px; + padding: 30px 0; +} + +.content { + padding: 0 30px; +} + +.input { + background: #fff; + box-shadow: 0px 0px 95px -30px rgba(0, 0, 0, 0.15); + border-radius: 12px; + padding: 20px 0; + margin-bottom: 20px; +} + +.input label { + display: block; + font-size: 18px; + font-weight: 600; + color: #000; + margin-bottom: 20px; +} + +.input input { + outline: none; + border: none; + border-bottom: 1px solid #4f7df9; + width: 50%; + text-align: center; + font-size: 28px; + font-family: "Nunito", sans-serif; +} + .inputW { background: #fff; box-shadow: 0px 0px 95px -30px rgba(0, 0, 0, 0.15); @@ -347,4 +696,6 @@ button.calculate:hover { .linkDownload { display: none; } -} \ No newline at end of file +} + +}