"Product chooser / selector"
Bootstrap 3.1.0 Snippet by renswijnmalen

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">
<h2>Normal</h2>
<div class="row form-group product-chooser">
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="product-chooser-item selected">
<img src="http://renswijnmalen.nl/bootstrap/desktop_mobile.png" class="img-rounded col-xs-4 col-sm-4 col-md-12 col-lg-12" alt="Mobile and Desktop">
<div class="col-xs-8 col-sm-8 col-md-12 col-lg-12">
<span class="title">Mobile and Desktop</span>
<span class="description">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.</span>
<input type="radio" name="product" value="mobile_desktop" checked="checked">
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="product-chooser-item">
<img src="http://renswijnmalen.nl/bootstrap/desktop.png" class="img-rounded col-xs-4 col-sm-4 col-md-12 col-lg-12" alt="Desktop">
<div class="col-xs-8 col-sm-8 col-md-12 col-lg-12">
<span class="title">Desktop</span>
<span class="description">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.</span>
<input type="radio" name="product" value="desktop">
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
<div class="product-chooser-item">
<img src="http://renswijnmalen.nl/bootstrap/mobile.png" class="img-rounded col-xs-4 col-sm-4 col-md-12 col-lg-12" alt="Mobile">
<div class="col-xs-8 col-sm-8 col-md-12 col-lg-12">
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
div.clear
{
clear: both;
}
div.product-chooser{
}
div.product-chooser.disabled div.product-chooser-item
{
zoom: 1;
filter: alpha(opacity=60);
opacity: 0.6;
cursor: default;
}
div.product-chooser div.product-chooser-item{
padding: 11px;
border-radius: 6px;
cursor: pointer;
position: relative;
border: 1px solid #efefef;
margin-bottom: 10px;
margin-left: 10px;
margin-right: 10x;
}
div.product-chooser div.product-chooser-item.selected{
border: 4px solid #428bca;
background: #efefef;
padding: 8px;
filter: alpha(opacity=100);
opacity: 1;
}
div.product-chooser div.product-chooser-item img{
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
$(function(){
$('div.product-chooser').not('.disabled').find('div.product-chooser-item').on('click', function(){
$(this).parent().parent().find('div.product-chooser-item').removeClass('selected');
$(this).addClass('selected');
$(this).find('input[type="radio"]').prop("checked", true);
});
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments:

$('div.product-chooser').not('.disabled').find('div.product-chooser-item').on('click', function(){ should be
$('div.product-chooser').find('div.product-chooser-item').not('.disabled').on('click', function(){

Hardnonymous () - 9 years ago - Reply 0


thank u so much for an amazing snipp , i have just one request would u plz make another one that support checkbox (multi selection) i am sorry i don't know javascript
and thank you again

sultan () - 9 years ago - Reply 0


How to properly add a link to a page ?

webbeur () - 9 years ago - Reply 0


Could you please provide more details?

maxsurguy () - 9 years ago - Reply 0