diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 01907349..4031f78b 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -70,3 +70,18 @@ UTIL = { //document.observe("dom:loaded", UTIL.init); //prototype $(document).ready(UTIL.init); //jquery $(function(){ $(document).foundation(); }); + +//scroll to top +$(window).scroll(function () { + if ($(this).scrollTop() > 100) { + $(".scrollup").fadeIn(); + } else { + $(".scrollup").fadeOut(); + } +}); +$(".scrollup").click(function () { + $("html, body").animate({ + scrollTop: 0 + }, 600); + return false; +}); diff --git a/app/assets/stylesheets/index.css.scss b/app/assets/stylesheets/index.css.scss index 5f1b0fe6..31dbde56 100644 --- a/app/assets/stylesheets/index.css.scss +++ b/app/assets/stylesheets/index.css.scss @@ -145,3 +145,16 @@ body[data-controller="home"][data-action="index"] { background: linear-gradient(to bottom, #0ac9de 0%,#33878e 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0ac9de', endColorstr='#33878e',GradientType=0 ); } + +/* Back to top scroll */ +.scrollup { + font-size: 60px; + width: 50px; + height: 50px; + opacity: 0.3; + position: fixed; + bottom: 155px; + right: 35px; + border-radius: 5px; + display: none; +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b6e00ace..7b850f6c 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -12,21 +12,21 @@
- + - + - +