Skip to content

Instantly share code, notes, and snippets.

@nucklearproject
Created January 17, 2013 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nucklearproject/4560028 to your computer and use it in GitHub Desktop.
Save nucklearproject/4560028 to your computer and use it in GitHub Desktop.
jQuery(window).load(function () {
// console.log(jQuery.cookie("scrollTop"));
setTimeout(function () {
jQuery('body').trigger('resize');
}, 200);
if ('referrer' in document && typeof document.referrer != undefined) {
var url_parts = document.referrer.split("/");
var url = url_parts[0] + "//" + url_parts[2];
if (window.location.href.indexOf(url) == -1) {
jQuery.removeCookie('scrollTop');
}
}
//console.log('2 ' + jQuery.cookie("scrollTop"));
if (jQuery.cookie("scrollTop")) {
jQuery('html, body').animate({
scrollTop:jQuery.cookie("scrollTop")
});
}
jQuery(window).bind('scroll resize', function () {
jQuery.cookie("scrollTop", jQuery(window).scrollTop());
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment