<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<a href="javascript:;">switch device</a>
<div class="device macbook">
<div class="monitor">
<div class="camera"></div>
<div class="screen"></div>
</div>
<div class="keyboard">
<div class="button"></div>
<div class="body"></div>
</div>
</div>
</body>
</html>
.device *{
transition: all 0.2s;
transition: all 0.2s;
transition: all 0.2s;
transition: all 0.2s;
}
body{
background:#aaa;
padding:30px 0 0;
text-align:center;
}
a{
display:inline-block;
height:30px;
padding:0 20px;
line-height:30px;
text-decoration:none;
color:#333;
background:#fff;
border-radius:2px;
}
a:hover{
background:#333;
color:#fff
}
.device{
position:relative;
margin:20px auto 0;
width:100%;
}
.monitor {
top:0;
left:50%;
position:absolute;
background:#fff;
}
.screen {
background:#333;
}
.camera{
background:#333;
border-radius:50%;
}
.keyboard{
position:absolute;
background:#fff;
left:50%;
}
.body{
background:#fff;
}
.button{
background:#ccc;
}
.macbook .monitor {
margin:0 0 0 -123px;
width:246px;
height:170px;
border-radius:7px;
}
.macbook .screen {
width:228px;
height:142px;
margin: 3px auto 0;
}
.macbook .camera{
width:4px;
height:4px;
margin:3px auto 0;
}
.macbook .keyboard{
width:300px;
height:5px;
margin:0 0 0 -150px;
top:165px;
}
.macbook .body{
width:300px;
height:5px;
margin:1px 0 0;
border-radius:0 0 12px 12px / 0 0 5px 5px;
}
.macbook .button{
width:42px;
height:4px;
margin:0 auto;
border-radius:0 0 4px 4px;
}
/*--------*/
.iphone .monitor{
margin:0 0 0 -45px;
width:90px;
height:180px;
border-radius:12px;
}
.iphone .screen{
width:78px;
height:116px;
margin:12px auto 0;
}
.iphone .camera{
border-radius:2px;
width:18px;
height:4px;
margin:16px auto 0;
}
.iphone .keyboard{
width:90px;
height:20px;
top:148px;
margin:0 0 0 -45px;
}
.iphone .body{
width:90px;
height:12px;
border-radius:0 0 12px 12px;
}
.iphone .button{
width:14px;
height:14px;
margin:6px auto 0;
border-radius:50%;
}
$(document).ready(function(){
$("a").click(function(){
$(".device").toggleClass("macbook");
$(".device").toggleClass("iphone");
// $(".iphone").removeClass("iphone").addClass("macbook");
});
});
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |