Skip to content

Country

Pool Volume Calculator

Pool Volume Calculator

.pool-calculator { font-family: Arial, sans-serif; background-color: #f9f9f9; padding: 20px; border-radius: 8px; max-width: 400px; margin: 0 auto; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } .pool-calculator h2 { text-align: center; color: #333; } .pool-calculator label { display: block; margin: 8px 0; } .pool-calculator input, .pool-calculator select { width: 100%; padding: 8px; margin-bottom: 12px; border-radius: 4px; border: 1px solid #ccc; } .pool-calculator button { width: 100%; padding: 10px; background-color: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; } .pool-calculator button:hover { background-color: #0056b3; } #result { text-align: center; margin-top: 20px; } #result p { font-size: 18px; font-weight: bold; } function calculateVolume() { const shape = document.getElementById('shape').value; let volume = 0; // For rectangle and oval shapes if (shape === 'rectangle' || shape === 'kidney') { const length = parseFloat(document.getElementById('length').value); const width = parseFloat(document.getElementById('width').value); const depth = parseFloat(document.getElementById('depth').value); if (isNaN(length) || isNaN(width) || isNaN(depth)) { alert('Please enter valid numbers for all fields.'); return; } if (shape === 'rectangle') { // Volume = Length * Width * Depth (in cubic feet) volume = length * width * depth; } else if (shape === 'kidney') { // Kidney-shaped pool volume is approximated (length * width * depth) * 0.8 volume = length * width * depth * 0.8; } } // For circular pools if (shape === 'circle') { const radius = parseFloat(document.getElementById('radius').value); const depth = parseFloat(document.getElementById('depth').value); if (isNaN(radius) || isNaN(depth)) { alert('Please enter valid numbers for all fields.'); return; } // Volume = π * radius² * depth (in cubic feet) volume = Math.PI * Math.pow(radius, 2) * depth; } // Display the result if (volume > 0) { document.getElementById('result').style.display = 'block'; document.getElementById('volume').textContent = `Your pool volume is approximately ${volume.toFixed(2)} cubic feet.`; } else { alert('Please fill in all the fields correctly.'); } } // Show/hide fields based on pool shape selection document.getElementById('shape').addEventListener('change', function () { const shape = this.value; if (shape === 'circle') { document.getElementById('dimensions').style.display = 'none'; document.getElementById('circle-dimensions').style.display = 'block'; } else { document.getElementById('dimensions').style.display = 'block'; document.getElementById('circle-dimensions').style.display = 'none'; } });

Compare products

{"one"=>"Select 2 or 3 items to compare", "other"=>"{{ count }} of 3 items selected"}

Select first item to compare

Select second item to compare

Select third item to compare

Compare