Demo
Code:
https://brivium.com/
Cách làm
Vào overall_footer_begin[/url] thêm vào cuối :
Code:
<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>
<style>
div#page {
max-width: 900px;
margin-left: auto;
margin-right: auto;
padding: 20px;
}
.back-to-top {
position: fixed;
right: 10px;
bottom: 30px;
display: none;
width: 50px;
height: 50px;
background-color: rgba(68,68,68,0.5);
color: white;
border-radius: 100%;
z-index: 9998;
text-align: center;
transition: background 0.6s;
}
.back-to-top:hover {
background-color: rgba(135, 135, 135, 0.50);
text-decoration: none;
}
.back-to-top i {
transition: all .5s;
font-size: 35px;
position: absolute;
left: 50%;
top: 45%;
-webkit-transform: rotate(-45deg) translateY(-50%);
-ms-transform: rotate(-45deg) translateY(-50%);
transform: rotate(-45deg) translateY(-50%);
}
.back-to-top i:hover {
font-size: 60px;
color: #ff7800;
text-shadow: 0 0 2px white,0 0 2px white,0 0 2px white,0 0 2px white,0 0 2px white;
transition: all .5s;
}
a.back-to-top:hover {
background: none!Important;
}
</style>
<a class="back-to-top" href="#"><i class="fa fa-plane" aria-hidden="true"></i></a>
Thế thôi +1 nhé
Tags: #top #trandangduat