Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"Quick Emulator"
Bootstrap 3.3.0 Snippet by
tjhall13
3.3.0
jQuery
Preview
HTML
CSS
JS
View Full Screen
Fork
Fork this
5.3K
 
0 Fav
Post to Facebook
Tweet this
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.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 ----------> <input id="width" type="text" value="320"> <input id="height" type="text" value="548"> <button id="resize">Resize</button> <div class="wrapper" style="width: 320px; height: 548px;"> <div class="phone-body"> <div class="phone-area"> <!-- Your code here --> <div> <div class="center"> <img src="http://lorempixel.com/people/420/420/"> </div> </div> <!-- End code --> </div> </div> </div>
body { padding: 10px; background: #aaa; } .wrapper { position: absolute; top: 40px; left: 40%; } .phone-body { border: 10px solid black; border-radius: 10px; width: calc(100% + 20px); height: calc(100% + 20px); } .phone-area { width: 100%; height: 100%; background: #fff; overflow-y: auto; overflow-x: hidden; } .center { width: 80%; margin: auto; } .center > img { width: 100%; } .center:before { content: ''; vertical-align: middle; display: inline-table; }
$(function() { $('#resize').click(function() { var width = $('#width').val(); var height = $('#height').val(); var style = 'width: ' + width + 'px; height: ' + height + 'px;'; $('.wrapper').attr('style', style); }); });
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76