scroll to top like a boss

This commit is contained in:
Maxwell Salzberg 2011-08-09 01:04:54 -07:00
parent e845bcf8e7
commit 72b734e3e8
3 changed files with 25 additions and 1 deletions

View file

@ -107,6 +107,9 @@
%br
= link_to t('.have_a_problem'), 'http://diaspora.shapado.com/'
%a{:id=>"back-to-top", :title=>"Back to top", :href=>"#"}
⇧
-if !@landing_page && request.url.match(/joindiaspora.com/)
:javascript
var is_ssl = ("https:" == document.location.protocol);
@ -122,4 +125,3 @@
feedback_widget_options.color = "#222";
feedback_widget_options.style = "idea";
var feedback_widget = new GSFN.feedback_widget(feedback_widget_options);

View file

@ -25,6 +25,17 @@ var View = {
$('#main_stream label').inFieldLabels();
});
/*scroll to top */
jQuery(window).scroll(function(){
if(jQuery(window).scrollTop() > 1000){
// show back to top
jQuery('#back-to-top').stop().animate({opacity: 1});
}
else{
// hide back to top
jQuery('#back-to-top').stop().animate({opacity: 0});
}
});
/* Showing debug messages */
$(this.debug.selector)

View file

@ -3367,3 +3367,14 @@ ul#getting_started
.accept_invitation_text
:font
:weight lighter
#back-to-top
:display block
:color white
:position fixed
:right 20px
:top 50px
:opacity 0
:font-size 3em
:padding 0 12px 0 12px
:border-radius 10px
:background-color #82D400