Calculator Tools Calculator Tools
Create

Progress Bar App

Sep 5, 2023

About this app

A simple app with a progress bar that fills up by 5% on button click.

Progress Bar App Progress Bar App Fill Up

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>Progress Bar App</title>
<meta name="description" content="A simple app with a progress bar that fills up by 5% on button click.">
<meta name="keywords" content="progress bar, button, fill up, simple app">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/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/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">

<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.
document.addEventListener("DOMContentLoaded", function() {
// Get the progress bar element
const progressBar = document.getElementById("progress-bar");

// Set the initial progress to 0%
let progress = 0;

// Function to update the progress bar
function updateProgressBar() {
progressBar.style.width = `${progress}%`;
}

// Button click event handler
$("#fill-button").click(function() {
// Increment the progress by 5%
progress += 5;

// Update the progress bar
updateProgressBar();
});
});

} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
/* App CSS Goes Here */
body {
background-color: #f2f2f2;
font-family: 'Roboto', sans-serif;
}

.container {
max-width: 400px;
margin: 50px 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;
}

.progress-bar-container {
height: 20px;
background-color: #ccc;
border-radius: 10px;
overflow: hidden;
}

.progress-bar {
height: 100%;
background: linear-gradient(to right, #98d3b5, #3f9bdf);
width: 0;
}

#fill-button {
display: block;
width: 100%;
text-align: center;
padding: 10px;
margin-top: 20px;
background-color: #3f9bdf;
color: #fff;
border: none;
border-radius: 5px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s ease;
}

#fill-button:hover {
background-color: #1d7bbe;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Progress Bar App</h1>
<div class="progress-bar-container">
<div id="progress-bar" class="progress-bar"></div>
</div>
<button id="fill-button">Fill Up</button>
</div>
</body>
</html>