Vertical Jump Calculator
Measure your explosive power by calculating your vertical leap.
Your Vertical Jump
25 in
${text}
`; interpretationResultDiv.className = `p-4 rounded-lg mt-4 ${colorClass}`; resultsDiv.classList.remove('hidden'); }; // --- Interpretation Logic (based on general adult population) --- const getInterpretation = (jumpInInches) => { if (jumpInInches >= 30) { return { text: 'Elite: An outstanding vertical jump, indicative of superior athletic ability.', colorClass: 'bg-violet-100 text-violet-800' }; } else if (jumpInInches >= 24) { return { text: 'Excellent: A very strong jump, well above average for most athletes.', colorClass: 'bg-blue-100 text-blue-800' }; } else if (jumpInInches >= 20) { return { text: 'Good: A solid, athletic jump that is above average.', colorClass: 'bg-green-100 text-green-800' }; } else if (jumpInInches >= 16) { return { text: 'Average: A typical vertical jump for the general population.', colorClass: 'bg-yellow-100 text-yellow-800' }; } else { return { text: 'Needs Improvement: This is a below-average jump. Consistent training can improve this score.', colorClass: 'bg-red-100 text-red-800' }; } }; // --- PDF Generation --- const generatePdf = () => { const { jsPDF } = window.jspdf; if (typeof jsPDF === 'undefined') { console.error("jsPDF library not loaded."); return; } const standingReach = standingReachInput.value; const jumpingReach = jumpingReachInput.value; const unit = unitSelect.options[unitSelect.selectedIndex].text; const jumpResultText = jumpResultP.textContent; const interpretationText = interpretationResultDiv.textContent; const doc = new jsPDF(); const pageWidth = doc.internal.pageSize.width; // Add Header doc.setFont('helvetica', 'bold'); doc.setFontSize(22); doc.setTextColor(41, 128, 185); // A nice blue color doc.text('Vertical Jump Analysis Report', pageWidth / 2, 20, { align: 'center' }); // Add Sub-Header with Date doc.setFont('helvetica', 'normal'); doc.setFontSize(11); doc.setTextColor(127, 140, 141); const reportDate = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); doc.text(`Date: ${reportDate}`, pageWidth / 2, 28, { align: 'center' }); // Add Input Data Section doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(44, 62, 80); doc.text('Your Measurements', 14, 45); doc.setLineWidth(0.5); doc.line(14, 47, pageWidth - 14, 47); doc.setFont('helvetica', 'normal'); doc.setFontSize(12); doc.text(`- Standing Reach: ${standingReach} ${unit}`, 20, 55); doc.text(`- Jumping Reach: ${jumpingReach} ${unit}`, 20, 65); // Add Result Section doc.setFont('helvetica', 'bold'); doc.setFontSize(16); doc.setTextColor(44, 62, 80); doc.text('Calculation Result', pageWidth / 2, 85, { align: 'center' }); doc.setFillColor(245, 245, 245); doc.roundedRect((pageWidth / 2) - 40, 90, 80, 30, 3, 3, 'F'); doc.setFontSize(30); doc.setTextColor(41, 128, 185); doc.text(jumpResultText, pageWidth / 2, 108, { align: 'center' }); // Add Interpretation Section doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(44, 62, 80); doc.text('Performance Analysis', 14, 140); doc.line(14, 142, pageWidth - 14, 142); doc.setFont('helvetica', 'normal'); doc.setFontSize(12); const interpretationLines = doc.splitTextToSize(interpretationText, pageWidth - 28); doc.text(interpretationLines, 14, 150); doc.save('Vertical_Jump_Report.pdf'); }; // --- Event Listeners --- if (calculateBtn) { calculateBtn.addEventListener('click', calculateVerticalJump); } if (downloadPdfBtn) { downloadPdfBtn.addEventListener('click', generatePdf); } });