<a id="tbc_back_to_top_btn"></a>
const tbc_back_to_top_btn = $('#tbc_back_to_top_btn');
$(window).scroll(function() {
if ($(window).scrollTop() > 300) {
tbc_back_to_top_btn.addClass('show');
} else {
tbc_back_to_top_btn.removeClass('show');
}
});
tbc_back_to_top_btn.on('click', function(e) {
e.preventDefault();
$('html, body').animate({scrollTop:0}, '300');
});
#tbc_back_to_top_btn {
display: inline-block;
background-color: #FF9800;
width: 50px;
height: 50px;
text-align: center;
border-radius: 100%;
position: fixed;
bottom: 30px;
right: 30px;
transition: background-color .3s,
opacity .5s, visibility .5s;
opacity: 0;
visibility: hidden;
z-index: 1000;
}
#tbc_back_to_top_btn::after {
content: "\f106";
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
font-size: 2em;
line-height: 50px;
color: #fff;
}
#tbc_back_to_top_btn:hover {
cursor: pointer;
background-color: #333;
}
#tbc_back_to_top_btn.show {
opacity: 1;
visibility: visible;
}