Difference between revisions of "Team:HSNU-TAIPEI/HP/Material/PPT"
Line 75: | Line 75: | ||
</div> | </div> | ||
</header> | </header> | ||
+ | <script src="http://code.jquery.com/jquery-1.9.1.js"></script> | ||
+ | <script> | ||
+ | jQuery(document).ready(function() { | ||
+ | var offset = 220; | ||
+ | var duration = 500; | ||
+ | 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> | ||
+ | <style> | ||
+ | .back-to-top { | ||
+ | position: fixed; | ||
+ | bottom: 5em; | ||
+ | right: 15px; | ||
+ | text-decoration: none; | ||
+ | color: #000000; | ||
+ | background-color: rgba(235, 235, 235, 0.80); | ||
+ | font-size: 1.39em; | ||
+ | font-family: 微軟正黑體; | ||
+ | font-weight: bold; | ||
+ | letter-spacing: 0.1em; | ||
+ | padding: 0.5em; | ||
+ | display: none; | ||
+ | } | ||
+ | |||
+ | .back-to-top:hover { | ||
+ | background-color: rgba(135, 135, 135, 0.50); | ||
+ | } | ||
+ | </style><a href="#" class="back-to-top"> 回到頁首 </a> | ||
<main> | <main> | ||
<div> | <div> |
Revision as of 09:31, 23 August 2015