Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(window).scroll(function () {
- if ($(this).scrollTop() > 300) {
- $('.scroll-to-top').fadeIn();
- } else {
- $('.scroll-to-top').fadeOut();
- }
- });
- $('.scroll-to-top').click(function () {
- $('body,html').animate({
- scrollTop: 0
- }, 750);
- return false;
- });
- <div class="scroll-to-top"><i class="fa fa-angle-double-up" aria-hidden="true"></i></div>
- <style>
- .scroll-to-top
- position: fixed
- bottom: 30px
- right: 30px
- cursor: pointer
- display: none
- z-index: 10
- background-color: $accent
- padding: 6px 12px 6px
- border-radius: 50px
- transition: all 0.4s ease
- box-shadow: 0 0 5px rgba(255,255,255,.8)
- &:hover
- padding: 8px 15px 8px
- background-color: darken($accent, 10%)
- .fa
- font-size: 30px
- color: #fff
- line-height: 1
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement