Powered by Smartsupp

Poradca

Ako si vypočítať koľko krytiny potrebujem?


Ako si vypočítať sklon strechy?

<!DOCTYPE html>
<html lang="sk">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Výpočet sklonu strechy</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        .container {
            max-width: 400px;
            margin: 0 auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 8px;
        }
        label, input, button {
            display: block;
            width: 100%;
            margin-bottom: 10px;
        }
        input, button {
            padding: 10px;
            font-size: 16px;
        }
        button {
            background-color: #4CAF50;
            color: white;
            border: none;
            cursor: pointer;
        }
        button:hover {
            background-color: #45a049;
        }
        .result {
            margin-top: 20px;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Výpočet sklonu strechy</h1>
        <label for="rise">Výška (výstup) v metroch:</label>
        <input type="number" id="rise" step="0.01" required>
        
        <label for="run">Dĺžka (základňa) v metroch:</label>
        <input type="number" id="run" step="0.01" required>
        
        <button onclick="calculateSlope()">Vypočítať sklon</button>
        
        <div id="result" class="result"></div>
    </div>

    <script>
        function calculateSlope() {
            var rise = parseFloat(document.getElementById('rise').value);
            var run = parseFloat(document.getElementById('run').value);

            if (isNaN(rise) || isNaN(run)) {
                document.getElementById('result').innerText = "Prosím zadajte platné čísla.";
                return;
            }

            var slope = (rise / run) * 100;
            document.getElementById('result').innerText = "Sklon strechy je " + slope.toFixed(2) + "%.";
        }
    </script>
</body>
</html>