"Image Checkbox Buttons"
Bootstrap 3.0.3 Snippet by newbie2014

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.0.3/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<br />
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<form class="form-horizontal well" role="form">
<div class="row">
<div class="col-xs-4">
<img src="http://placehold.it/160x100" class="img-responsive img-radio">
<button type="button" class="btn btn-primary btn-radio">PM</button>
<input type="checkbox" id="left-item" class="hidden">
</div>
<div class="col-xs-4">
<img src="http://placehold.it/160x100" class="img-responsive img-radio">
<button type="button" class="btn btn-primary btn-radio">WMZ</button>
<input type="checkbox" id="middle-item" class="hidden">
</div>
<div class="col-xs-4">
<img src="http://placehold.it/160x100" class="img-responsive img-radio">
<button type="button" class="btn btn-primary btn-radio">BTC</button>
<input type="checkbox" id="right-item" class="hidden">
</div>
</div>
<div class="row space-20">
<div class="col-xs-12">
<div class="form-group">
<label for="inputTitle" class="col-sm-2 control-label">AMOUNT</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputTitle">
</div>
</div>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
.btn-radio {
width: 100%;
}
.img-radio {
opacity: 0.5;
margin-bottom: 5px;
}
.space-20 {
margin-top: 20px;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
$(function () {
$('.btn-radio').click(function(e) {
$('.btn-radio').not(this).removeClass('active')
.siblings('input').prop('checked',false)
.siblings('.img-radio').css('opacity','0.5');
$(this).addClass('active')
.siblings('input').prop('checked',true)
.siblings('.img-radio').css('opacity','1');
});
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: