content logo

Bootstrap Buttons:

On Click Loading Effect for Bootstrap Buttons

There are a lot of tasks in a website that take more than just a second to complete. Also, the more complex your website is and the more pages it has, the loading speed will decrease and these tasks will take even longer. Now, leaving your users wondering what is happening while the website is processing something can be confusing. You should always remember that a website’s user interface should be easy to understand. Any confusion might lead to negative reactions and you might lose a lot of potential users this way.

One great way to avoid this is by using loading buttons. Theses buttons are designed to give the users a feedback and let them know that the browser is doing its thing so just wait for a few seconds. This helps make things clear and avoid frustrating the users. Also, they won’t click the button rapidly which could make the task even slower.

In this post, we have a Bootstrap button with loading effects. The design includes a blue Bootstrap loading button which will display a little animation once clicked. So, let’s say a user just completes the payment process and clicks the button to submit the buy request. This Bootstrap animating button will then show a small loading icon plus the phrase “processing order”. Using this animated button can help avoid confusion greatly.

#

Bootstrap Animating Button

#

Animated Button

#

Bootstrap Loading Button

#

Bootstrap Button with Loading

<!-- This script got from frontendfreecode.com -->
<div style="margin:3em;text-align:center">
<button type="button" class="btn btn-primary btn-lg " id="load1" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Processing Order">Submit Order</button>
<br>
  <br>
<button type="button" class="btn btn-primary btn-lg" id="load2" data-loading-text="<i class='fa fa-spinner fa-spin '></i> Processing Order">Submit Order</button>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
$('.btn').on('click', function () {
    var $this = $(this);
    $this.button('loading');
    setTimeout(function () {
        $this.button('reset');
    }, 8000);
});
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js'></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js'></script>
</head>
<body>
<div style="margin:3em;text-align:center">
<button type="button" class="btn btn-primary btn-lg " id="load1" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Processing Order">Submit Order</button>
<br>
  <br>
<button type="button" class="btn btn-primary btn-lg" id="load2" data-loading-text="<i class='fa fa-spinner fa-spin '></i> Processing Order">Submit Order</button>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
$('.btn').on('click', function () {
    var $this = $(this);
    $this.button('loading');
    setTimeout(function () {
        $this.button('reset');
    }, 8000);
});
</script>

</body>
</html>
Preview