<style>
#backToTopBtn {
display: none;
position: fixed;
bottom: 70px;
right: 0%;
width: 40px;
height: 40px;
font-size: 24px;
background-color: #fca311;
color: #14213d;
border: none;
cursor: pointer;
opacity:0;
transition: opacity 0.3s ease-in-out;
animation:1s;
display:flex;
justify-content:center;
align-items:center;
z-index:100030;
}
#backToTopBtn i {
font-size:16px;
color:white;
}
.showBtn {
opacity: 1!important;
}
</style>
<button onclick="scrollToTop()" id="backToTopBtn" title="Retour en haut" data-aos="fade-left">
<i class="fas fa-long-arrow-alt-up"></i>
</button>
<script>
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: "smooth"
});
}
window.addEventListener("scroll", function() {
// button back to top
var button = document.getElementById("backToTopBtn");
// div share
var share = document.querySelector('.share');
// var i de H avec la classe special
var ispeci = document.querySelector('.eNavigation');
// function
if (window.scrollY > 300) {
button.classList.add('showBtn');
share.classList.add('showBtn')
} else {
button.classList.remove('showBtn');
share.classList.remove('showBtn');
}
// function
if (window.scrollY > 550) {
} else {
}
});
</script>