<html>
<head>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/01/cover-origami-files-08.png" style="position:absolute;margin-top:-7px;margin-left:12%;z-index:20" usemap="#blueBall" href="#" />
<map id="blueBallMap" name="blueBall"><area shape="poly" alt="" title="" coords="15,134,23,124,42,122,56,120,64,134,66,143,71,156,70,172,62,177,59,187,21,187,1,169,13,141,13,138,12,139" href="" target="" /></map>
<div id="cyclerBlue" class="cycler">
<img id="initializerImageBlue" class="active" src="" />
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/02/1.png" alt="My image" />
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/02/2.png" alt="My image" />
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/02/3.png" alt="My image" />
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/02/4.png" alt="My image" />
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/02/5.png" alt="My image" />
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/02/6.png" alt="My image" />
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/02/7.png" alt="My image" />
<img src="http://www.branddiaries.com/development/wp-content/uploads/2014/02/8.png" alt="My image" />
</div>
</body>
</html>
var counter = 1;
var currentBallDiv;
var currentBallInitImage;
function initializeAnimation(e) {
$(currentBallDiv).find('img').each(function(){$(this).removeClass('active');}).hide();
$(currentBallInitImage).addClass('active');
var newX = e.pageX - 100;
var newY = e.pageY - 150;
var fadeOutTimer = 20;
$(currentBallDiv).show().css({left: newX+'px',top: newY+'px'});
counter = 1;
setTimeout('cycleImages()', 60);
}
function cycleImages(){
var $active = $(currentBallDiv).find('.active');
var $next = ($active.next().length > 0) ? $active.next() : $(currentBallDiv).find('img:first');
$next.css('z-index',2).show();//move the next image up the pile
$active.fadeOut(fadeOutTimer,function(){//fade out the top image
$active.css('z-index',1).hide().removeClass('active');//reset the z-index and unhide the image
$next.css('z-index',3).addClass('active').show();//make the next image the top one
});
if (counter < 6) {
counter++;setTimeout('cycleImages()', 60);
} else if (counter < 9) {
counter++;fadeOutTimer = 1000;setTimeout('cycleImages()', 1000);
}
}
$(document).ready(function(){
$(document).click(function(){
$('.cycler').hide();
});
$('map[name=blueBall] area').on('click',function(e){
fadeOutTimer = 20;
currentBallDiv = $('#cyclerBlue');
currentBallInitImage = $('#initializerImageBlue');
initializeAnimation(e);
e.stopPropagation();
});
})
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. |