"Understanding Responsive Utilities"
Bootstrap 3.1.0 Snippet by mrmccormack

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">
<div class="row">
<h4> Mr. M.'s Understanding TB's Responsive Utilities</h4>
<p>
Example of using Twitter Bootstrap 3's "responsive utilities"
</p>
<!-- see JS file for writing out size of window in class testp -->
<p class="testp btn btn-success pull-right"></p>
<p>
<a href="http://bootsnipp.com/iframe/4PK2" target="_blank">View Full Screen</a>
</p>
<div class="visible-lg">
<img src="http://i.imgur.com/RqrdXAj.jpg" alt="" class="img-responsive img-rounded center-block">
<p class="text-center btn-danger">
Large devices Desktops (≥1200px)
</p>
</div>
<div class="visible-md">
<img src="http://i.imgur.com/Xsdbf9u.jpg" alt="" class="img-responsive img-rounded center-block">
<p class="text-center btn-warning">
Medium devices Desktops (≥992px)
</p>
</div>
<div class="visible-sm">
<img src="http://i.imgur.com/uEh5Wq3.jpg" alt="" class="img-responsive img-rounded center-block">
<p class="text-center btn-info">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
body{
background-color:black;
color:#ccc;
}
img{
padding:30px
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
* How to detect browser width
* Ref: http://www.surfingsuccess.com/jquery/window-width.html#.Uw1RiV6Lfx4
*/
$(window).ready(function() {
var wi = $(window).width();
$("p.testp").text('Initial screen width is: ' + wi + 'px.');
$(window).resize(function() {
var wi = $(window).width();
$("p.testp").text('Width is currently: ' + wi + 'px.');
});
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: