Skip to content

Instantly share code, notes, and snippets.

@mr21
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mr21/8850522 to your computer and use it in GitHub Desktop.
Save mr21/8850522 to your computer and use it in GitHub Desktop.
/*
This little code move the speeder on the 404 error page of GitHub.
For a demo :
* Copy the code below with Ctrl+C.
* Find a 404 error page (like this one: "https://github.com/@").
* Paste the code in the address bar.
* Add "javascript:" at the beginning of the code.
* Press enter, enjoy! :D
--
I don't use the argument (number) "progress" of jQuery in the progress callback,
because this number goes from 0 to 1 linearly but not easingly...
*/
(function(){
var $speeder = jQuery('#parallax_speeder'),
$shad = jQuery('#parallax_speedershadow'),
shadH = $shad.height(),
dur = 2500,
up = -25;
function shadCSS(){
var p = parseInt($speeder.css('marginTop')) / up;
$shad.css('height', (shadH - up * p) + 'px');
$shad.css('opacity', 1 - p / 2);
}
function speederB(){$speeder.animate({marginTop: '0px'},{duration:dur,progress:shadCSS,complete:speederA})}
function speederA(){$speeder.animate({marginTop:up+'px'},{duration:dur,progress:shadCSS,complete:speederB})}
speederA();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment