Calculator Tools Calculator Tools
Create

Curtain Fabric Calculator

Oct 11, 2023

About this app

Calculate the amount of fabric needed for your curtains

Curtain Fabric Calculator Curtain Fabric Calculator Width (in inches): Height (in inches): Gather (%): Repeat (in inches): Calculate

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Curtain Fabric Calculator</title>
<meta name="description" content="Calculate the amount of fabric needed for your curtains">
<meta name="keywords" content="curtain, fabric, calculator, dimensions">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet">

<script type="text/javascript">
try {
document.addEventListener("DOMContentLoaded", function() {
// Function to calculate the fabric needed
function calculateFabric() {
// Get the input values
const width = parseFloat($("#width").val());
const height = parseFloat($("#height").val());
const gather = parseFloat($("#gather").val());
const repeat = parseFloat($("#repeat").val());

// Calculate the total fabric needed
const fabricNeeded = (width * gather * repeat * height) / 36;

// Display the result
$("#result").text("Total Fabric Needed: " + fabricNeeded.toFixed(2) + " yards");
}

// Event listener for the calculate button
$("#calculate-btn").on("click", function() {
calculateFabric();
});
});

} catch (error) {
throw error;
}
</script>

<style>
body {
font-family: 'Poppins', sans-serif;
background-color: #f8f9fa;
}

.container {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h1 {
text-align: center;
margin-bottom: 30px;
color: #333;
}

.form-group {
margin-bottom: 20px;
}

label {
font-weight: bold;
}

input[type="number"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}

.btn {
width: 100%;
padding: 10px;
border-radius: 5px;
background-color: #007bff;
color: #fff;
font-weight: bold;
cursor: pointer;
}

#result {
text-align: center;
margin-top: 20px;
color: #333;
font-weight: bold;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Curtain Fabric Calculator</h1>

<div class="form-group">
<label for="width">Width (in inches):</label>
<input type="number" id="width" placeholder="Enter width">
</div>

<div class="form-group">
<label for="height">Height (in inches):</label>
<input type="number" id="height" placeholder="Enter height">
</div>

<div class="form-group">
<label for="gather">Gather (%):</label>
<input type="number" id="gather" placeholder="Enter gather percentage">
</div>

<div class="form-group">
<label for="repeat">Repeat (in inches):</label>
<input type="number" id="repeat" placeholder="Enter repeat size">
</div>

<button id="calculate-btn" class="btn">Calculate</button>

<div id="result"></div>
</div>
</body>
</html>