smooth scroll like a smooth criminal

This commit is contained in:
Maxwell Salzberg 2011-08-11 15:19:16 -07:00
parent d9904ecd30
commit 0981f04c77

View file

@ -26,18 +26,24 @@ var View = {
}); });
/*scroll to top */ /*scroll to top */
var back_to_top = jQuery('#back-to-top');
jQuery(window).scroll(function(){ jQuery(window).scroll(function(){
if(jQuery(window).scrollTop() > 1000){ if(jQuery(window).scrollTop() > 1000){
// show back to top // show back to top
jQuery('#back-to-top').stop().animate({opacity: .5}); back_to_top.stop().animate({opacity: .5});
} }
else{ else{
// hide back to top // hide back to top
jQuery('#back-to-top').stop().animate({opacity: 0}); back_to_top.stop().animate({opacity: 0});
} }
}); });
/* Showing debug messages */ back_to_top.click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:0}, 500);
})
/* Showing debug messages */
$(this.debug.selector) $(this.debug.selector)
.click(this.debug.click); .click(this.debug.click);