Cool switch

by karim79

HTML

<section id="stage">
            
            <div class="slider-frame">
                <span class="slider-button">NO</span>
            </div>

        </section>

CSS

#stage .slider-frame {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  margin: 0 auto;
  width: 85px;
  height: 29px;
  background-color: #404040;
  background-repeat: no-repeat;
  background-image: -webkit-gradient(linear, left top, left bottom, from(#2b2b2b), to(#404040));
  background-image: -webkit-linear-gradient(#2b2b2b, #404040);
  background-image: -moz-linear-gradient(#2b2b2b, #404040);
  background-image: -o-linear-gradient(top, #2b2b2b, #404040);
  background-image: -khtml-gradient(linear, left top, left bottom, from(#2b2b2b), to(#404040));
  filter: progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#2b2b2b', EndColorStr='#404040', GradientType=0);
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#2b2b2b', EndColorStr='#404040', GradientType=0))";
  border-top: 1px solid #333333;
  border-right: 1px solid #333333;
  border-bottom: 1px solid #666666;
  border-left: 1px solid #333333;
  -moz-border-radius: 5px;
  border-radius: 5px;
  -webkit-box-shadow: inset 0px 1px 8px 0 rgba(0, 0, 0, 0.25);
  -moz-box-shadow: inset 0px 1px 8px 0 rgba(0, 0, 0, 0.25);
  box-shadow: inset 0px 1px 8px 0 rgba(0, 0, 0, 0.25);
}
#stage .slider-frame .slider-button {
  display: block;
  margin: 0;
  padding: 0;
  width: 43px;
  height: 27px;
  line-height: 27px;
  background: #d37a16;
  -moz-border-radius: 5px;
  border-radius: 5px;
  border: 1px solid #70430e;
  -webkit-transition: all 0.25s ease-in-out;
  -moz-transition: all 0.25s ease-in-out;
  transition: all 0.25s ease-in-out;
  color: #fff;
  font-family:Helvetica;
  font-size:11px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  text-align: center;
  cursor: pointer;
}
#stage .slider-frame .slider-button.on {
  margin-left: 40px;
  background: #2372c6;
  border: 1px solid #0f3f74;
}
#stage .slider-frame .slider-button:before {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  width: 43px;
  height: 12px;
  background:...

JavaScript

$('.slider-button').toggle(function(){
        $(this).addClass('on').html('YES');
    },function(){
        $(this).removeClass('on').html('NO');
    });