"SolutionsPal Calculate Th"
Bootstrap 3.1.0 Snippet by SolutionsPal

<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="price-box"> <div class="row"> <div class="price-slider"> <h4 class="great">Annual Income</h4> <div class="col-sm-12"> <div id="slider_amirol"></div> </div> </div> <div class="row"> <div class="col-sm-4"> <label for="amount_amirol" class="control-label">Annually ($): </label> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_y_1" type="text" id="total_y_1" disabled="disabled" style="" /> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_y_2" type="text" id="total_y_2" disabled="disabled" style="" /> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_y_4" type="text" id="total_y_4" disabled="disabled" style="" /> </div> </div> <div class="row"> <div class="col-sm-4"> <label for="amount_amirol" class="control-label">Monthly ($): </label> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_m_1" type="text" id="total_m_1" disabled="disabled" style="" /> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_m_2" type="text" id="total_m_2" disabled="disabled" style="" /> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_m_4" type="text" id="total_m_4" disabled="disabled" style="" /> </div> </div> <div class="row"> <div class="col-sm-4"> <label for="amount_amirol" class="control-label">Weekly ($): </label> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_w_1" type="text" id="total_w_1" disabled="disabled" style="" /> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_w_2" type="text" id="total_w_2" disabled="disabled" style="" /> </div> <div class="col-sm-2"> <input class="price lead" name="totalprice_w_4" type="text" id="total_w_4" disabled="disabled" style="" /> </div> </div> </div> </div> </div> <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
body { padding-top: 60px; } .price-box { margin: 0 auto; background: #E9E9E9; border-radius: 10px; padding: 40px 15px; width: 300px; } .ui-widget-content { border: 1px solid #bdc3c7; background: #e1e1e1; color: #222222; margin-top: 4px; } .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 7.2em; height: 2.7em; cursor: default; margin: 0 0px auto !important; /* 40 */ text-align: center; line-height: 30px; color: #FFFFFF; font-size: 12px; } .ui-slider .ui-slider-handle .glyphicon { color: #FFFFFF; margin: 0 1px; font-size: 11px; opacity: 0.7; } .ui-corner-all { border-radius: 20px; } .ui-slider-horizontal .ui-slider-handle { top: .9em; } .ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #f9f9f9; background: #3498db; } .ui-slider-horizontal .ui-slider-handle { margin-left: 0.5em; } .ui-slider .ui-slider-handle { cursor: pointer; } .ui-slider a, .ui-slider a:focus { cursor: pointer; outline: none; } .price, .lead p { font-weight: 600; font-size: 12px; display: inline-block; line-height: 18px; border:0; width: 50px; } h4.great { background: #00ac98; margin: 0 0 25px 60px; padding: 7px 15px; color: #ffffff; font-size: 18px; font-weight: 600; border-radius: 5px; display: inline-block; -moz-box-shadow: 2px 4px 5px 0 #ccc; -webkit-box-shadow: 2px 4px 5px 0 #ccc; box-shadow: 2px 4px 5px 0 #ccc; } .total { border-bottom: 1px solid #7f8c8d; /*display: inline; padding: 10px 5px;*/ position: relative; padding-bottom: 20px; } .total:before { content: ""; display: inline; position: absolute; left: 0; bottom: 5px; width: 100%; height: 3px; background: #7f8c8d; opacity: 0.5; } .price-slider { margin-bottom: 70px; } .price-slider span { font-weight: 200; display: inline-block; color: #7f8c8d; font-size: 13px; } .form-pricing { background: #ffffff; padding: 20px; border-radius: 4px; } .price-form { background: #ffffff; margin-bottom: 10px; padding: 20px; border: 1px solid #eeeeee; min-height: 520px; border-radius: 4px; /*-moz-box-shadow: 0 5px 5px 0 #ccc; -webkit-box-shadow: 0 5px 5px 0 #ccc; box-shadow: 0 5px 5px 0 #ccc;*/ } .form-group { margin-bottom: 0; } .form-group span.price { font-weight: 200; display: inline-block; color: #7f8c8d; font-size: 14px; } .help-text { display: block; margin-top: -10px; margin-bottom: 10px; color: #737373; /*position: absolute;*/ /*margin-left: 20px;*/ font-weight: 200; /*text-align: right;*/ width: 188px; } .price-form label, .price-box .control-label { font-weight: 200; font-size: 12px; } .ui-slider-range-min { background: #2980b9; }
// JavaScript Document var p = { 0: "25K", 1: "40K", 2: "50K", 3: "60K", 4: "70K", 5: "80K", 6: "90K", 7: "100K", 8: "110K", 9: "120K", 10: "130K", 11: "140K", 12: "150K", 13: "175K", 14: "200K", 15: "250K", 16: "275K", 17: "300K", 18: "400K", 19: "500K", 20: "600K", 21: "750K", 22: "900K", 23: "1,000K", 24: "1,200K", 25: "1,700K", 26: "1,800K" }; var t = { 0: "25000", 1: "40000", 2: "50000", 3: "60000", 4: "70000", 5: "80000", 6: "90000", 7: "100000", 8: "110000", 9: "120000", 10: "130000", 11: "140000", 12: "150000", 13: "175000", 14: "200000", 15: "250000", 16: "275000", 17: "300000", 18: "400000", 19: "500000", 20: "600000", 21: "750000", 22: "900000", 23: "1000000", 24: "1200000", 25: "1700000", 26: "1800000" } $(document).ready(function() { $("#total_y_1").val("25000"); $("#slider_amirol").slider({ range: "min", animate: true, min: 0, max: 26, step: 1, slide: function(event, ui) { update(1,ui.value); //changed calcualtePrice(ui.value); } }); update(); calcualtePrice(); }); function update(slider,val) { if(undefined === val) val = 0; var amount = p[val]; $('#sliderVal').val(val); $('#slider_amirol a').html('<label><span class="glyphicon glyphicon-chevron-left"></span> '+amount+' <span class="glyphicon glyphicon-chevron-right"></span></label>'); } function calcualtePrice(val){ if(undefined === val) val = $('#sliderVal').val(); var totalPrice = t[val]*1; //must have *1 to convert to number $("#total_y_1").val(Math.round( (((totalPrice)*0.1)/1) ).toFixed(0)); $("#total_m_1").val(Math.round( (((totalPrice)*0.1)/12) ).toFixed(0)); $("#total_w_1").val(Math.round( (((totalPrice)*0.1)/52) ).toFixed(0)); $("#total_y_2").val(Math.round( (((totalPrice)*0.05)/1) ).toFixed(0)); $("#total_m_2").val(Math.round( (((totalPrice)*0.05)/12) ).toFixed(0)); $("#total_w_2").val(Math.round( (((totalPrice)*0.05)/52) ).toFixed(0)); $("#total_y_4").val(Math.round( (((totalPrice)*0.025)/1) ).toFixed(0)); $("#total_m_4").val(Math.round( (((totalPrice)*0.025)/12) ).toFixed(0)); $("#total_w_4").val(Math.round( (((totalPrice)*0.025)/52) ).toFixed(0)); }

Related: See More


Questions / Comments: