Skip to content

Instantly share code, notes, and snippets.

@geoffyuen
Last active December 24, 2015 00:40
Show Gist options
  • Save geoffyuen/6718659 to your computer and use it in GitHub Desktop.
Save geoffyuen/6718659 to your computer and use it in GitHub Desktop.
Quick and dirty way to view your site at 320, 480, 768. Append ?<your site url without http://>. Eg. look.html?bing.com
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>320 | 480 | 768</title>
<style>
html, body {
background: #444;
height: 100%;
margin: 0;
padding: 0;
text-align: center;
overflow-y: hidden;
}
#w320 {
width: 320px;
}
#w480 {
width: 480px;
position: relative;
}
#w768 {
width: 768px;
}
#w320, #w768 {
box-shadow: 0 0 20px #000;
}
iframe {
border-width: 0;
background: #fff;
height: 100%;
display: inline-block;
margin: 0 1px;
}
</style>
</head>
<body>
<iframe id="w320"></iframe><iframe id="w480"></iframe><iframe id="w768"></iframe>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>
$(function() {
var earl = ($(location).attr('search')).split('?')[1];
$('iframe').attr('src', 'http://' + earl);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment