<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>
<div id="images" align="center">
<img src="http://i.imgur.com/miuh9.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/S0Z42.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/iu1a1.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ocIme.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ltboP.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/bO8Nm.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/miuh9.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/S0Z42.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/iu1a1.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ocIme.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ltboP.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/bO8Nm.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/miuh9.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/S0Z42.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/iu1a1.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ocIme.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ltboP.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/bO8Nm.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/miuh9.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/S0Z42.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/iu1a1.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ocIme.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ltboP.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/bO8Nm.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/miuh9.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/S0Z42.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/iu1a1.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ocIme.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ltboP.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/bO8Nm.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/miuh9.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/S0Z42.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/iu1a1.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ocIme.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ltboP.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/bO8Nm.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/miuh9.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/S0Z42.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/iu1a1.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ocIme.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ltboP.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/bO8Nm.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/miuh9.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/S0Z42.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/iu1a1.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ocIme.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/ltboP.jpg" border="0" class="simplehover" width="140" height="105" />
<img src="http://i.imgur.com/bO8Nm.jpg" border="0" class="simplehover" width="140" height="105" />
</div>
</body>
</html>
$('.simplehover').each(function(){
var $this = $(this);
// make sure that element is really an image
if (! $this.is('img')) return false;
var isrc = $this[0].src, dv = null;
if (! isrc) return false;
$this.mouseenter(function(e){
dv = $('<div />')
.attr('class', '__shidivbox__')
.css({
'display': 'none',
'z-index' : 9999,
'position': 'absolute',
'box-shadow': '0 0 1em #000',
'border-radius' : '5px'
})
.html('<img alt="" src="' + isrc + '" />')
.appendTo(document.body);
var DocuWidth = window.innerWidth;
var DocuHeight = window.innerHeight;
var DvImg = dv.find('img');
var TheImage = new Image();
TheImage.src = DvImg.attr("src");
var DivWidth = TheImage.width;
var DivHeight = TheImage.height;
if (DivWidth > DocuWidth) {
var WidthFactor = (DivWidth / DocuWidth) + 0.05;
DivHeight = parseInt((DivHeight / WidthFactor), 10);
DivWidth = parseInt((DivWidth / WidthFactor), 10);
}
var ThumbHeight = $this.height();
var ThumbWidth = $this.width();
var ThumbTop = $this.position().top;
var ThumbLeft = $this.position().left;
var SpaceAboveThumb = ThumbTop - $(document).scrollTop();
var SpaceBelowThumb = DocuHeight - ThumbTop - ThumbHeight + $(document).scrollTop();
var MaxHeight = Math.max(SpaceAboveThumb, SpaceBelowThumb);
if (DivHeight > MaxHeight) {
var HeightFactor = (DivHeight / MaxHeight) + 0.05;
DivHeight = parseInt((DivHeight / HeightFactor), 10);
DivWidth = parseInt((DivWidth / HeightFactor), 10);
}
var HoverImgLeft = 0;
var HoverImgTop = 0;
if (SpaceBelowThumb > SpaceAboveThumb) {
HoverImgTop = ThumbTop + ThumbHeight;
} else {
HoverImgTop = ThumbTop - DivHeight;
}
HoverImgTop = (HoverImgTop < 0) ? 0 : HoverImgTop;
HoverImgLeft = (DocuWidth - DivWidth) / 2;
dv.find('img').css({
'width': DivWidth,
'height': DivHeight,
'border-radius':'5px'
});
dv.css({
'left': HoverImgLeft,
'top': HoverImgTop
});
dv.fadeIn('fast');
});
$this.mouseleave(function(){
dv.fadeOut('fast');
});
});
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. |