Last active
August 29, 2015 13:56
-
-
Save mr21/8850522 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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