Skip to content

Commit

Permalink
Added scroll to top in footer (#2251)
Browse files Browse the repository at this point in the history
  • Loading branch information
namangupta01 authored and jywarren committed Feb 17, 2018
1 parent eda66c3 commit b2b9390
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@
//= require chart.js/dist/Chart.js
// require turbolinks // Temporarily removed while fixing
//= require google_analytics.js
//= require header_footer.js

11 changes: 11 additions & 0 deletions app/assets/javascripts/header_footer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
jQuery(document).ready(function() {
var duration = 300;

$(".back-to-top").click(function(event) {
event.preventDefault();
jQuery("html, body").animate({scrollTop: 0}, duration);
return false;
})

});

12 changes: 12 additions & 0 deletions app/assets/stylesheets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,15 @@ div.note.moderated h4 {
font-size: 80%;
}
}

.back-to-top {

float: right;

}

.back-to-top i {

font-size: 60px;

}
5 changes: 5 additions & 0 deletions app/views/layouts/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
<% end %>
</ul>
</ul>

<a href="#" class="back-to-top" style="display: inline;">
<i class="fa fa-arrow-circle-up"></i>
</a>

</div>
<br style="clear:both;" />
</footer>

0 comments on commit b2b9390

Please sign in to comment.