"Bootstrap Pricing Slider [Mobile Touch UI]"
Bootstrap 3.1.0 Snippet by momodinium

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<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">
<center>
<strong>ORIGINAL</strong>
<br><br>
http://bootsnipp.com/snippets/featured/bootstrap-pricing-slider-donations<br><br>
<strong>REVISIONS</strong>
<h4>- Added jquery.ui.touch-punch.min.js from http://touchpunch.furf.com <br><br>
- Due to glitchy dragging, changed css to have normal sized .label on slider, but large transparent tab hidden.
</h4>
</center>
<br><br>
<!-- START -->
<div class="price-box">
<form class="form-horizontal form-pricing" role="form">
<div class="price-slider">
<h4 class="great">Amount</h4>
<span>Minimum $10 is required</span>
<div class="col-sm-12">
<div id="slider"></div>
</div>
</div>
<div class="price-slider">
<h4 class="great">Duration</h4>
<span>Minimum 1 day is required</span>
<div class="col-sm-12">
<div id="slider2"></div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
body {
padding-top: 50px;
padding-bottom: 50px;
}
.price-box {
margin: 0 auto;
background: #E9E9E9;
border-radius: 10px;
padding: 40px 15px;
width: 500px;
}
.ui-widget-content {
border: 1px solid #bdc3c7;
background: #e1e1e1;
color: #222222;
margin-top: 4px;
}
.ui-state-default, .ui-widget-content .ui-state-default{
background:transparent !important;
border:none !important;
}
.ui-slider .ui-slider-handle label{
background: #428bca;
border-radius: 20px;
width:5.2em;
}
.ui-slider .ui-slider-handle {
position: absolute;
z-index: 2;
width: 5.2em;
height: 100px;
cursor: default;
margin: 0 -40px auto !important;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$(document).ready(function() {
$("#slider").slider({
animate: true,
value:1,
min: 0,
max: 1000,
step: 10,
slide: function(event, ui) {
update(1,ui.value); //changed
}
});
$("#slider2").slider({
animate: true,
value:0,
min: 0,
max: 500,
step: 1,
slide: function(event, ui) {
update(2,ui.value); //changed
}
});
//Added, set initial value.
$("#amount").val(0);
$("#duration").val(0);
$("#amount-label").text(0);
$("#duration-label").text(0);
update();
});
//changed. now with parameter
function update(slider,val) {
//changed. Now, directly take value from ui.value. if not set (initial, will use current value.)
var $amount = slider == 1?val:$("#amount").val();
var $duration = slider == 2?val:$("#duration").val();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: