Skip to content

Instantly share code, notes, and snippets.

@jgwhite
Created February 10, 2012 18:23
Show Gist options
  • Save jgwhite/1791454 to your computer and use it in GitHub Desktop.
Save jgwhite/1791454 to your computer and use it in GitHub Desktop.
Rikify
<!doctype html>
<html>
<head>
<title>Rikify</title>
<style type="text/css">
#button {
font-family: Lucida Grande;
font-size: 11px;
text-decoration: none;
font-weight: bold;
display: inline-block;
background: #999;
padding: 2px 6px 3px;
border-radius: 10px;
color: rgba(0, 0, 0, 0.75);
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5);
}
#box {
display: block;
text-align: center;
padding: 100px;
}
</style>
</head>
<body>
<div id="box">
<p>Drag this thing to your bookmark bar:</p>
<a href="javascript:var s = document.createElement('script');s.src = 'https://raw.github.com/gist/1791454/rikify.js';document.body.appendChild(s);" id="button">Rikify</a>
</div>
</body>
</html>
(function() {
var RIK_URL = 'http://f.cl.ly/items/3Q0W0U352d1u1A310g14/rikhead.png';
var rik = new Image();
rik.src = RIK_URL;
rik.style.position = 'fixed';
rik.style.top = window.innerHeight + 'px';
rik.style.webkitTransform = 'translate(0, 0px)';
rik.style.zIndex = 5000;
document.body.appendChild(rik);
var appear = function() {
rik.style.left = Math.round(Math.random() * (window.innerWidth - 200)) + 'px';
rik.style.webkitTransition = '-webkit-transform 0.333s';
rik.style.webkitTransform = 'translate(0, -140px)';
setTimeout(disappear, 1000);
}
var disappear = function() {
rik.style.webkitTransition = '-webkit-transform 0.333s';
rik.style.webkitTransform = 'translate(0, 0px)';
setTimeout(appear, 2000);
}
setTimeout(appear, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment