Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(window).scroll(function() {
- if ($(window).scrollTop() > 550) {
- $('div.to-top-btn').fadeIn('fast');
- } else {
- $('div.to-top-btn').fadeOut('slow');
- }
- });
- $('div.to-top-btn').click(function() {
- $('html, body').animate({
- scrollTop: 0
- }, 1000);
- return false;
- });
- /* CSS */
- .to-top-btn {
- width: 50px;
- height: 50px;
- position: fixed;
- bottom: 30px;
- right: 40px;
- border-radius: 100px;
- background: rgba(0,0,0,0.5);
- display: none;
- cursor: pointer;
- }
- .to-top-btn .fa-arrow-up {
- margin: 16px 0 0 16px;
- color: white;
- }
- /* end css */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement