-
-
Save Hatteron/73f76293632f3f0caeb4bced594e3ac1 to your computer and use it in GitHub Desktop.
Scroll Top Button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="top" title="Наверх"><i class="fa fa-angle-double-up"></i></div> | |
.top | |
position: fixed | |
bottom: 25px | |
background-color: #E0E0E0 | |
border-radius: 10em | |
color: #666 | |
font-size: 26px | |
width: 50px | |
height: 50px | |
line-height: 50px | |
text-align: center | |
cursor: pointer | |
transition: all .25s ease | |
right: -100px | |
z-index: 12 | |
opacity: .5 | |
&.active | |
right: 30px | |
i | |
line-height: 0 | |
&:hover | |
color: #fff | |
background-color: $accent | |
opacity: 1 | |
/* Extra Small Devices, Phones */ | |
@media only screen and (max-width : 480px) | |
.top | |
bottom: 20px | |
&.active | |
right: 20px | |
$('.top').click(function() { | |
$('html, body').stop().animate({scrollTop: 0}, 'slow', 'swing'); | |
}); | |
$(window).scroll(function() { | |
if ($(this).scrollTop() > $(window).height()) { | |
$('.top').addClass("active"); | |
} else { | |
$('.top').removeClass("active"); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment