Your search did not match any results.
Progress Bar

Progress Bar

Documentation

The ProgressBar is a UI component that shows current progress.

Backend API
Copy to CodePen
Apply
Reset
$(() => { let seconds = 10; let inProgress = false; let intervalId; const progressBarStatus = $('#progressBarStatus').dxProgressBar({ min: 0, max: 100, width: '90%', statusFormat(value) { return `Loading: ${value * 100}%`; }, onComplete(e) { inProgress = false; progressButton.option('text', 'Restart progress'); e.element.addClass('complete'); }, }).dxProgressBar('instance'); const progressButton = $('#progress-button').dxButton({ text: 'Start progress', width: 200, onClick() { $('#progressBarStatus').removeClass('complete'); if (inProgress) { progressButton.option('text', 'Continue progress'); clearInterval(intervalId); } else { progressButton.option('text', 'Stop progress'); setCurrentStatus(); intervalId = setInterval(timer, 1000); } inProgress = !inProgress; }, }).dxButton('instance'); function setCurrentStatus() { progressBarStatus.option('value', (10 - seconds) * 10); $('#timer').text((`0${seconds}`).slice(-2)); } function timer() { seconds -= 1; setCurrentStatus(); if (seconds === 0) { clearInterval(intervalId); seconds = 10; } } });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.2.3/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.2.3/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/21.2.3/js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div class="form"> <div id="progress-button"></div> <div class="progress-info"> Time left 00:00:<span id="timer">10</span> </div> <div id="progress"><div id="progressBarStatus"></div></div> </div> </div> </body> </html>
.form { padding: 20% 0; text-align: center; } #progress-button { margin-bottom: 20px; } #progressBarStatus { display: inline-block; } .complete .dx-progressbar-range { background-color: green; }