Skip to content

Instantly share code, notes, and snippets.

@yoko
Created September 16, 2008 07:01
Show Gist options
  • Save yoko/11004 to your computer and use it in GitHub Desktop.
Save yoko/11004 to your computer and use it in GitHub Desktop.
Scroll = function(end) {
this.end = end || 0;
this.start = this.getStart();
};
Scroll.prototype = {
getStart: function() {
return $(window).scrollTop();
},
go: function(callback) {
$().scrollTop(this.end);
callback();
},
animate: function(options) {
options = $.extend({
duration: 150
}, options);
$('html, body').animate({
scrollTop: this.end
}, options);
},
back: function() {
$().scrollTop(this.start);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment