Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added scroll to top in footer #2251

Merged
merged 1 commit into from
Feb 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>