Dynamic Pricing Table



Dynamic Pricing Table




 <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
</head>
<body>
  <div class="section">
    <h1>Dynamic Pricing Table</h1>
    <div class="options-table">
      <form>
        <div class="switch">
          <span>Pro Package</span>
          <input id="choice-1" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" data-price="100">
          <label for="choice-1"></label>
          <div class="clearfix"></div>
        </div>
        <div class="switch">
          <span>Designer Package</span>
          <input id="choice-2" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" data-price="200">
          <label for="choice-2"></label>
          <div class="clearfix"></div>
        </div>
        <div class="switch">
          <span>Developer Package</span>
          <input id="choice-3" class="cmn-toggle cmn-toggle-round-flat" type="checkbox" data-price="350">
          <label for="choice-3"></label>
          <div class="clearfix"></div>
        </div>
      </form>
    </div>

    <div class="pricing-table">
      <ul>
        <li class="price"><i>$</i><span>100</span></li>
        <li><i>+</i>3 Years Managed Hosting</li>
        <li><i>+</i>Unlimited Domains</li>
        <li class="choice-1"><i>+</i>2 Year Warranty</li>
        <li class="choice-1"><i>+</i>Unlimited Service and Maintenance</li>
        <li class="choice-2"><i>+</i>Drag and Drop Designer</li>
        <li class="choice-2"><i>+</i>5 Ready Made Templates</li>
        <li class="choice-3"><i>+</i>Advanced Statistics</li>
        <li class="choice-3"><i>+</i>Custom CSS Options</li>
        <li><i>+</i>Basic Statistics</li>
      </ul>
    </div>
  </div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</body>                    
                  
                



 html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}

/* CSS RESET DONE */
html, body {
  height: 100%;
}
body {
  color: #fff;
  margin: 0 auto;
  font: 1em/1.3em Helvetica, sans-serif;
	background-color: #ddd9d2;
  font-family: 'Montserrat', Helvetica, arial, sans-serif;
}
.dark {
  display: block;
  position: absolute;
  top: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,.3);
}
.background {
  display: block;
  position: absolute;
  top: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
  .background img { width: 100%; }

  @media (max-width: 767px) {
    .background img { 
      width: auto; 
      height: 100%;
    }
  }


.clearfix {
  clear: both;
}
.section {
  width: 960px;
  margin: 0 auto;
  text-align: center;
}
h1 {
  margin: 40px 0;
  font-size: 40px;
  line-height: 40px;
  font-weight: bold;
  text-shadow: 0px 1px 1px rgba(0,0,0,.2);
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
}
a {
  text-decoration: none;
  color: #fff;  
  margin: 0 10px;
}

/* Button styles */
.btn {
  box-sizing:border-box;
   -moz-box-sizing:border-box;
   -webkit-box-sizing:border-box;
  
  position: relative;
  display: inline-block;
  overflow: hidden;
  height: 50px;
  
  border-radius: 6px;
  -moz-border-radius: 6px;
  -webkit-border-radius: 6px;
    
  line-height: 50px;
  padding: 0 30px;  
  margin-bottom: 40px;
  font-size: 14px;
  text-shadow: 0 1px rgba(0,0,0,.1);
  font-weight: bold;
  -webkit-font-smoothing: antialiased;

  -webkit-box-shadow: 0 3px 0 0 #72ad0d;
  box-shadow: 0 3px 0 0 #72ad0d;
  background-color: #9bd668;
}
  .btn:active,
  .btn.active {
    top: 2px;
    -webkit-box-shadow: 0 1px 0 0 #72ad0d;
    box-shadow: 0 1px 0 0 #72ad0d;
  }


/* Dynamic Pricing Table */
.pricing-table {
  width: 63%;
  float: right;
  background-color: #fff;
  font-weight: normal;
}
  li {
    padding: 15px 20px 0;
    color: #444;
    text-align: left;
    font-size: 14px;
    line-height: 23px;
  }
    li.price {
      padding: 15px 20px;
      text-align: center;
      color: #fff;
      line-height: 70px;
      font-size: 32px;
      background-color: #a36bc6;
    }
      li.price i {
        color: #fff;
        line-height: 70px;
        font-weight: normal;
        margin-right: 10px;
      }
    li i {
      vertical-align: top;
      color: #7fc442;
      font-size: 23px;
      font-weight: bold;
      line-height: 23px;
      margin-right: 15px;
    }
    li:last-child {
      padding: 15px 20px;
    }
    li[class^="choice"] {
      padding: 0 20px;
      overflow: hidden;
      height: 0px;

      transition: .3s;
      -webkit-transition: .3s;
    }
      li[class^="choice"].active {
        height: 23px;
        padding: 15px 20px 0;
      }

.options-table {
  width: 30%;
  float: left;
  padding: 20px;
  background-color: #fff;
  color: #666;
}
  .options-table .switch {
    margin-bottom: 20px;
  }
    .options-table .switch:last-child {
      margin-bottom: 0px;
    }
    .options-table .switch span {
      float: left;
      line-height: 30px;
    }
    .options-table .switch .cmn-toggle,
    .options-table .switch label {
      float: right;
    }

/* ============================================================
  COMMON
============================================================ */
.cmn-toggle {
  position: absolute;
  margin-left: -9999px;
  visibility: hidden;
}
.cmn-toggle + label {
  display: block;
  position: relative;
  cursor: pointer;
  outline: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
/* ============================================================
  SWITCH 2 - ROUND FLAT
============================================================ */
input.cmn-toggle-round-flat + label {
  padding: 1px;
  width: 60px;
  height: 30px;
  background-color: #dddddd;
  -webkit-border-radius: 30px;
  -moz-border-radius: 30px;
  -ms-border-radius: 30px;
  -o-border-radius: 30px;
  border-radius: 30px;
  -webkit-transition: background 0.4s;
  -moz-transition: background 0.4s;
  -o-transition: background 0.4s;
  transition: background 0.4s;
}
input.cmn-toggle-round-flat + label:before, input.cmn-toggle-round-flat + label:after {
  display: block;
  position: absolute;
  content: "";
}
input.cmn-toggle-round-flat + label:before {
  top: 1px;
  left: 1px;
  bottom: 1px;
  right: 1px;
  background-color: #ddd;
  -webkit-border-radius: 30px;
  -moz-border-radius: 30px;
  -ms-border-radius: 30px;
  -o-border-radius: 30px;
  border-radius: 30px;
  -webkit-transition: background 0.4s;
  -moz-transition: background 0.4s;
  -o-transition: background 0.4s;
  transition: background 0.4s;
}
input.cmn-toggle-round-flat + label:after {
  top: 3px;
  left: 3px;
  bottom: 3px;
  width: 26px;
  background-color: #fff;
  -webkit-border-radius: 26px;
  -moz-border-radius: 26px;
  -ms-border-radius: 26px;
  -o-border-radius: 26px;
  border-radius: 26px;
  -webkit-transition: margin 0.4s, background 0.4s;
  -moz-transition: margin 0.4s, background 0.4s;
  -o-transition: margin 0.4s, background 0.4s;
  transition: margin 0.4s, background 0.4s;
}
input.cmn-toggle-round-flat:checked + label, 
input.cmn-toggle-round-flat:checked + label:before {
  background-color: #9bd668;
}
input.cmn-toggle-round-flat:checked + label:after {
  margin-left: 30px;
}                
              



(function($){
	$(function(){

    $('.cmn-toggle').each(function () {
      $(this).change(function() {
        var curr_class = '.' + $(this).attr('id');
        var price = $(this).attr('data-price');
        var price_box = $('.pricing-table li.price span');

        $(curr_class).toggleClass('active');

        if (price) {
          if ($(curr_class).hasClass('active')) {
            price_box.html(parseInt(price_box.html()) + parseInt(price));
          }
          else {
            price_box.html(parseInt(price_box.html()) - parseInt(price));
          }          
        }


      });
    });
    
	}); // end of document ready
})(jQuery); // end of jQuery name space