content logo

Bootstrap Buttons:

Animating Bootstrap Buttons

Animations have become such a big part of the web design industry in the course past few years. It’s being used in many different features of a website and the most commonly used parts are the buttons. The buttons contain the action you want your users to do so you want them to click on it. Animations help this cause by a certain method. Many think that the purpose of an animated button is to draw someone’s attention and make them click on it. Think of it this way: the button shows a clear acknowledgement to assure the users that you did notice the interaction. In other words, this is used to provide feedback to the users. Once you learn this, you use animations properly based on behavioural content.

Following is a code for animated buttons. They could help your website both functionally and aesthetically. The code includes different animations for different purposes. It features a blue Bootstrap button with hover effect with its little icon spinning in hover mode. It also features a Bootstrap sale button which spins infinitely. This Bootstrap rotating button can be used in an e-commerce website or when you have a special sale going on your products and services in your website.

#

Bootstrap Sale Button

#

Animated Button

#

Bootstrap Rotating Button

#

Bootstrap Button with Hover

<!-- This script got from frontendfreecode.com -->
<div style="text-align:center">
    <button class="btn-primary" id="button-1">
        SEND <i class="glyphicon glyphicon-envelope"></i>
    </button>
    <hr />
    <button class="btn btn-warning button-2" id="button">
        CALLBACK <i class="glyphicon glyphicon-phone-alt call" id="call"></i>
    </button>
    <hr />
    <button class="btn btn-link button">
        CLICK<i class="glyphicon glyphicon-pencil"></i>
    </button>
    <hr />
    <button class="btn btn-danger animated" id="circle-butt">SALE</button>
    <hr />
    <button class="btn btn-danger last-button">CLICK <i class="glyphicon glyphicon-asterisk"></i></button><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
* {
  margin: 0;
  padding: 0;
}
body {
  background: #64AF9C;
  font-family: sans-serif;
}
#button-1 {
  width: 150px;
  height: 50px;
  border: none;
  border-bottom: 2px white solid;
  margin-top: 20px;
  transition: .5s all;
}
#button-1:hover i {
  -webkit-animation-name: circle;
          animation-name: circle;
  -webkit-animation-duration: 1s;
          animation-duration: 1s;
}
#button {
  width: 150px;
  height: 50px;
  transition: .5s all;
  margin-left: 3px;
}
#button:hover i {
  -webkit-animation: call;
          animation: call;
  -webkit-animation-duration: 1s;
          animation-duration: 1s;
}
.button {
  color: white;
  font-size: 24px;
}
.button:hover {
  text-decoration: line-through;
  color: white;
}.button:hover i {
  text-decoration: line-through;
  color: white;
}
.button i {
  margin-left: 3px;
}
.btn {
}
#circle-butt {
  width: 100px;
  height: 100px;
  border-radius: 50%;/*
  background: #A00000;*/
  font-weight: bold;
  color: white;
  border: dashed 3px white;
  transition: .5s all;
  -webkit-animation: circle;
          animation: circle;
  -webkit-animation-duration: 3s;
          animation-duration: 3s;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
  font-size: 24px;
}
#circle-butt:hover {
  border: solid;
}
.last-button {
  width: 150px;
  height: 50px;  
  background: #A00000;
  color: white;
  text-align: left;
  position: relative;
  padding-left: 30px;
  transition: .5s all;
  margin-bottom: 50px;
}
.last-button:hover {
  font-size: 12px;  
}
.last-button:hover i {
  color: white;
  -webkit-animation: circle;
          animation: circle;
  -webkit-animation-duration: 3s;
          animation-duration: 3s;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}
.last-button:active {
  color: white;
}
.last-button i {
  position: absolute;
  line-height: 50px;
  font-size: 30px;
  left: 90px;
}
@-webkit-keyframes call {
  0% {
      transform: scale(1);  
  } 
  50% {
      transform: scale(1.2);
   }
  100% {
      transform: scale(1);
   }
}
@keyframes call {
  0% {
      transform: scale(1);  
  } 
  50% {
      transform: scale(1.2);
   }
  100% {
      transform: scale(1);
   }
}
@-webkit-keyframes circle {
  0% {
     transform: rotate(0deg);
  }
  100% {
     transform: rotate(360deg);
  }
}
@keyframes circle {
  0% {
     transform: rotate(0deg);
  }
  100% {
     transform: rotate(360deg);
  }
}
$( document ).ready(function() {
    $('#button').hover(function() {
      $('#call').addClass('animated shake');
    });
});
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.3/animate.min.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.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.3.5/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.3/animate.min.css'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<style>
* {
  margin: 0;
  padding: 0;
}
body {
  background: #64AF9C;
  font-family: sans-serif;
}
#button-1 {
  width: 150px;
  height: 50px;
  border: none;
  border-bottom: 2px white solid;
  margin-top: 20px;
  transition: .5s all;
}
#button-1:hover i {
  -webkit-animation-name: circle;
          animation-name: circle;
  -webkit-animation-duration: 1s;
          animation-duration: 1s;
}
#button {
  width: 150px;
  height: 50px;
  transition: .5s all;
  margin-left: 3px;
}
#button:hover i {
  -webkit-animation: call;
          animation: call;
  -webkit-animation-duration: 1s;
          animation-duration: 1s;
}
.button {
  color: white;
  font-size: 24px;
}
.button:hover {
  text-decoration: line-through;
  color: white;
}.button:hover i {
  text-decoration: line-through;
  color: white;
}
.button i {
  margin-left: 3px;
}
.btn {
}
#circle-butt {
  width: 100px;
  height: 100px;
  border-radius: 50%;/*
  background: #A00000;*/
  font-weight: bold;
  color: white;
  border: dashed 3px white;
  transition: .5s all;
  -webkit-animation: circle;
          animation: circle;
  -webkit-animation-duration: 3s;
          animation-duration: 3s;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
  font-size: 24px;
}
#circle-butt:hover {
  border: solid;
}
.last-button {
  width: 150px;
  height: 50px;  
  background: #A00000;
  color: white;
  text-align: left;
  position: relative;
  padding-left: 30px;
  transition: .5s all;
  margin-bottom: 50px;
}
.last-button:hover {
  font-size: 12px;  
}
.last-button:hover i {
  color: white;
  -webkit-animation: circle;
          animation: circle;
  -webkit-animation-duration: 3s;
          animation-duration: 3s;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}
.last-button:active {
  color: white;
}
.last-button i {
  position: absolute;
  line-height: 50px;
  font-size: 30px;
  left: 90px;
}
@-webkit-keyframes call {
  0% {
      transform: scale(1);  
  } 
  50% {
      transform: scale(1.2);
   }
  100% {
      transform: scale(1);
   }
}
@keyframes call {
  0% {
      transform: scale(1);  
  } 
  50% {
      transform: scale(1.2);
   }
  100% {
      transform: scale(1);
   }
}
@-webkit-keyframes circle {
  0% {
     transform: rotate(0deg);
  }
  100% {
     transform: rotate(360deg);
  }
}
@keyframes circle {
  0% {
     transform: rotate(0deg);
  }
  100% {
     transform: rotate(360deg);
  }
}
</style>

</head>
<body>
<div style="text-align:center">
    <button class="btn-primary" id="button-1">
        SEND <i class="glyphicon glyphicon-envelope"></i>
    </button>
    <hr />
    <button class="btn btn-warning button-2" id="button">
        CALLBACK <i class="glyphicon glyphicon-phone-alt call" id="call"></i>
    </button>
    <hr />
    <button class="btn btn-link button">
        CLICK<i class="glyphicon glyphicon-pencil"></i>
    </button>
    <hr />
    <button class="btn btn-danger animated" id="circle-butt">SALE</button>
    <hr />
    <button class="btn btn-danger last-button">CLICK <i class="glyphicon glyphicon-asterisk"></i></button><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
$( document ).ready(function() {
    $('#button').hover(function() {
      $('#call').addClass('animated shake');
    });
});
</script>

</body>
</html>
Preview