Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Make sure you include JQUERY!! -->
- <style>
- .back-to-top {
- position: fixed;
- bottom: 2em;
- right: 0px;
- text-decoration: none !important;
- color: #000000;
- background-color: rgba(235, 235, 235, 0.80);
- font-size: 12px;
- padding: 1em;
- display: none;
- }
- .back-to-top:hover {
- background-color: rgba(135, 135, 135, 0.50);
- }
- </style>
- <!-- Place this at the bottom of your page -->
- <a href="#" class="back-to-top">Back to Top</a>
- <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>
Add Comment
Please, Sign In to add comment