Difference between revisions of "Team:British Columbia/Template/Protocols"
(Created page with "{{:Team:British Columbia/Template/Fixednavbar}}") |
|||
Line 1: | Line 1: | ||
{{:Team:British Columbia/Template/Fixednavbar}} | {{:Team:British Columbia/Template/Fixednavbar}} | ||
+ | <body> | ||
+ | <a class="back-to-top" style="display: inline;" href="#">Back to Top</a> | ||
+ | |||
+ | <script> | ||
+ | jQuery(document).ready(function() { | ||
+ | var offset = 250; | ||
+ | var duration = 300; | ||
+ | jQuery(window).scroll(function() { | ||
+ | if (jQuery(this).scrollTop() > offset) { | ||
+ | jQuery('.back-to-top').fadeIn(duration); | ||
+ | } else { | ||
+ | jQuery('.back-to-top').fadeOut(duration); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | jQuery('.back-to-top').click(function(event) { | ||
+ | event.preventDefault(); | ||
+ | jQuery('html, body').animate({scrollTop: 0}, duration); | ||
+ | return false; | ||
+ | }) | ||
+ | }); | ||
+ | </script> |
Revision as of 23:11, 31 March 2015
<script> jQuery(document).ready(function() {
var offset = 250; var duration = 300; jQuery(window).scroll(function() { if (jQuery(this).scrollTop() > offset) { jQuery('.back-to-top').fadeIn(duration); } else { jQuery('.back-to-top').fadeOut(duration); } });
jQuery('.back-to-top').click(function(event) { event.preventDefault(); jQuery('html, body').animate({scrollTop: 0}, duration); return false; })
}); </script>