Skip to content

JavaScript Loading Spinner

The jSuites.loading component is an ultra-lightweight JavaScript plugin that takes up less than 1 KB and is designed to integrate a responsive and efficient loading spinner into web applications. This minimalistic component offers a straightforward way to indicate processing or loading states, enhancing the user experience by providing visual feedback during data loading or function execution phases.

The loading will stop after two seconds
<html>
<script src="https://jsuites.net/v6/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v6/jsuites.css" type="text/css" />

<input type='button' value='Show the loading' class='jbutton dark' id='showbtn'>
<i class="small">The loading will stop after two seconds</i>

<script>
const show = function() {
    // Show the loading spin
    jSuites.loading.show();
    // Hide the loading spin after two seconds
    setTimeout(function() {
        // Hide
        jSuites.loading.hide();
    }, 2000);
}
showbtn.onclick = () => show()
</script>
</html>