Created
February 27, 2013 17:29
-
-
Save sidonaldson/5049788 to your computer and use it in GitHub Desktop.
Source code from usehook.com
This file contains hidden or 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
/******************************************************************************** | |
* The Source code from USEHOOK.COM | |
* Prettified via http://jsbeautifier.org/ | |
* | |
* Check it out. It's blooming awful code. | |
* It refreshes your page every time you hit scrollTop = 0!! | |
********************************************************************************/ | |
$(function () { | |
window.loadheight = $('#hook').height(); | |
window.hidden = $("#hook").animate("marginTop", "-" + loadheight + "px"); | |
window.visible = $("#hook").animate("marginTop", "0px"); | |
$("#hook").css("marginTop", "-" + loadheight + "px") | |
}); | |
$(function hook() { | |
var loadheight = $('#hook').height(); | |
$(window).scroll(function (event) { | |
var st = $(window).scrollTop(); | |
if (st <= 0) { | |
$("#hook").animate({ | |
"marginTop": "0px" | |
}, 200); | |
$("#hook").delay(500).slideUp(200, function () { | |
window.location.reload() | |
}) | |
} | |
if ($.browser.webkit) { | |
if (st == 0) { | |
$('body').css('overflow', 'hidden') | |
} | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment