diff options
Diffstat (limited to 'views/layout.haml')
-rw-r--r-- | views/layout.haml | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/views/layout.haml b/views/layout.haml index 7c05190..b6606a1 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -20,7 +20,32 @@ %h1 Lazar Toxicity Predictions %hr - .content + .content + :javascript + $(document).ready(function(){ + // hide #back-top first + $("#back-top").hide(); + // fade in #back-top + $(function () { + $(window).scroll(function () { + if ($(this).scrollTop() > 400) { + $('#back-top').fadeIn(); + } else { + $('#back-top').fadeOut(); + } + }); + // scroll body to 0px on click + $('#back-top a').click(function () { + $('body,html').animate({ + scrollTop: 0 + }, 500); + return false; + }); + }); + }); + #back-top + %a{:href => ""}^ top ^ + = yield .footer |