Loading animation
Custom JavaScript
<script type="text/javascript">
window.addEventListener('load', function() {
const progressBar = document.querySelector('.js-bolt-progress-bar-loading');
const progressBarReset = document.querySelector(
'.js-bolt-progress-bar-loading-reset',
);
let progressBarInitialValue;
function autoIncrementProgressBar() {
progressBarInitialValue = progressBar.value;
const myVar = setInterval(myTimer, 250);
function myTimer() {
progressBar.value += 1;
if (progressBar.value >= progressBar.max) {
clearInterval(myVar);
progressBar.animated = false;
progressBarReset.removeAttribute('disabled');
progressBarReset.textContent = 'Click to reset';
}
}
}
if (progressBar) {
autoIncrementProgressBar();
}
if (progressBarReset && progressBar) {
progressBarReset.addEventListener('click', () => {
progressBar.value = progressBarInitialValue;
progressBar.animated = true;
progressBarReset.setAttribute('disabled', '');
progressBarReset.textContent = 'Hang tight before resetting...';
autoIncrementProgressBar();
});
}
});
</script>