Skip to content

Instantly share code, notes, and snippets.

@sidonaldson
Created February 27, 2013 17:29
Show Gist options
  • Save sidonaldson/5049788 to your computer and use it in GitHub Desktop.
Save sidonaldson/5049788 to your computer and use it in GitHub Desktop.
Source code from usehook.com
/********************************************************************************
* 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