Skip to content

Instantly share code, notes, and snippets.

@cavill
Created May 4, 2012 13:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cavill/2594914 to your computer and use it in GitHub Desktop.
@themithify an page
(function() {
var RIK_URL = 'https://twimg0-a.akamaihd.net/profile_images/24543892/me.jpg';
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