Skip to content

Instantly share code, notes, and snippets.

@kisildev
Last active March 1, 2019 11:23
Show Gist options
  • Save kisildev/be2d4383ff60f2d161cdc191dd91a9fc to your computer and use it in GitHub Desktop.
Save kisildev/be2d4383ff60f2d161cdc191dd91a9fc to your computer and use it in GitHub Desktop.
Button Up
<div id="button-up" class="button-up">
<i class="fa fa-chevron-up" aria-hidden="true"></i>
</div>
.button-up {
width: 50px;
height: 50px;
border-radius: 50%;
background: #28108c;
position: fixed;
bottom: 70px;
right: 70px;
cursor: pointer;
z-index: 100;
text-align: center;
transition: all .5s ease;
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
}
.button-up:hover {
background: #000;
}
.button-up i {
color: #fff;
margin-top: 14px;
}
//Media CSS
.button-up {
bottom: 40px;
right: 40px;
width: 40px;
height: 40px;
}
.button-up i {
margin-top: 12px;
font-size: 13px;
}
$(window).scroll(function(){
if($(this).scrollTop() > 800) {
$('#button-up').fadeIn();
}
else {
$('#button-up').fadeOut();
}
});
$('#button-up').click(function () {
$('html, body').animate( {scrollTop: 0 }, 600 );
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment