content logo

Bootstrap Toggle Switches:

Bootstrap Toggle Switch with Effect

Toggle switches should deliver immediate results. The user expects the button to take effect instantly so a good toggle switch does not require the user to click another button such as “Submit” or “Save” to apply the change. Take the example of real world. Toggle switches are taken from normal switches in the real world such as a light switch. When you flip the switch one, you see the lights come on and that is what you expect. It would be weird and unnecessary to add in an extra step where you had to flip the switch and then push another lever or press a button for it to take effect. This is exactly what the users expect from your toggle switches in a website as well. You are going to want switches that grant users the control and freedom they need to update their preferences as needed.

With that said, we have a Bootstrap toggle switch with change colour effects. This toggle switch effect has a really sleek design with an animation to display every time you flick it to one side. The colour also changes from grey to green once our Bootstrap switch colour template is turned on. Using this toggle switch with attraction features will surely improve how good your site looks.

#

Bootstrap Switch Color

#

Toggle Switch with Attraction

#

Toggle Switch Effect

#

Switch with Change Color

<!-- This script got from frontendfreecode.com -->
<div class="container" style="text-align:center">
    <div class="row">
        <div class="col-sm-12">
            <h2>Bootstrap Switch</h2>
            <div>
                <label class="switch">
                    <input type="checkbox">
                    <span class="slider"></span>
                </label> Switch1
            </div>
          
        </div>
     
    </div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
/* Basic Rules */
.switch input { 
    display:none;
}
.switch {
    display:inline-block;
    width:60px;
    height:30px;
    margin:8px;
    transform:translateY(50%);
    position:relative;
}
/* Style Wired */
.slider {
    position:absolute;
    top:0;
    text-align:left!important;
    bottom:0;
    left:0;
    right:0;
    border-radius:30px;
    box-shadow:0 0 0 2px #777, 0 0 4px #777;
    cursor:pointer;
    border:4px solid transparent;
    overflow:hidden;
     transition:.4s;
}
.slider:before {
    position:absolute;
    content:"";
    width:100%;
    height:100%;
    background:#777;
    border-radius:30px;
    transform:translateX(-30px);
    transition:.4s;
}
input:checked + .slider:before {
    transform:translateX(30px);
    background:limeGreen;
}
input:checked + .slider {
    box-shadow:0 0 0 2px limeGreen,0 0 2px limeGreen;
}
/* Style Flat */
.switch.flat .slider {
 box-shadow:none;
}
.switch.flat .slider:before {
  background:#FFF;
}
.switch.flat input:checked + .slider:before {
 background:white;
}
.switch.flat input:checked + .slider {
  background:limeGreen;
}
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'></script>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'></script>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css'>
<style>
/* Basic Rules */
.switch input { 
    display:none;
}
.switch {
    display:inline-block;
    width:60px;
    height:30px;
    margin:8px;
    transform:translateY(50%);
    position:relative;
}
/* Style Wired */
.slider {
    position:absolute;
    top:0;
    text-align:left!important;
    bottom:0;
    left:0;
    right:0;
    border-radius:30px;
    box-shadow:0 0 0 2px #777, 0 0 4px #777;
    cursor:pointer;
    border:4px solid transparent;
    overflow:hidden;
     transition:.4s;
}
.slider:before {
    position:absolute;
    content:"";
    width:100%;
    height:100%;
    background:#777;
    border-radius:30px;
    transform:translateX(-30px);
    transition:.4s;
}
input:checked + .slider:before {
    transform:translateX(30px);
    background:limeGreen;
}
input:checked + .slider {
    box-shadow:0 0 0 2px limeGreen,0 0 2px limeGreen;
}
/* Style Flat */
.switch.flat .slider {
 box-shadow:none;
}
.switch.flat .slider:before {
  background:#FFF;
}
.switch.flat input:checked + .slider:before {
 background:white;
}
.switch.flat input:checked + .slider {
  background:limeGreen;
}
</style>

</head>
<body>
<div class="container" style="text-align:center">
    <div class="row">
        <div class="col-sm-12">
            <h2>Bootstrap Switch</h2>
            <div>
                <label class="switch">
                    <input type="checkbox">
                    <span class="slider"></span>
                </label> Switch1
            </div>
          
        </div>
     
    </div>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>

</body>
</html>
Preview