I'd like to change the icon for the 'back to top' code.
Also, the code only works when I put it into a code snippet element. It doesn't work in header/footer code in edit page section. Any help with this would also be appreciated.
<style>
.rounded-floating-btn {
position: fixed;
right: 20px;
width: 50px !important;
height: 75px !important;
bottom: 20px;
padding: 15px;
z-index: 5;
border-radius: 2px;
cursor: pointer;
background-color: #101010;
box-shadow: 0 0 25px rgba(0, 0, 0, 0.3);
color: #fff;
font-size: 70%;
font-weight: 400;
}
.floated-btn-svg-icon {
width: 20px;
fill: #fff;
margin: 0 auto;
margin-top: 3px;
}
.rounded-floating-btn .zptext {
margin-top: 3px;
}
</style>
<script>
window.onload=function(){
var div = document.createElement('div');
div.innerHTML='<div class="zpelem-box zpelement zpbox-container zpdefault-section zpdefault-section-bg rounded-floating-btn" data-background-type="none" style="display:none" id="scrollToTop"><div class="floated-btn-svg-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 268.831 268.832"><path d="M223.255 83.659l-80-79.998c-4.881-4.881-12.797-4.881-17.678 0l-80 80c-4.883 4.882-4.883 12.796 0 17.678 2.439 2.44 5.64 3.661 8.839 3.661s6.397-1.221 8.839-3.661l58.661-58.661v213.654c0 6.903 5.597 12.5 12.5 12.5 6.901 0 12.5-5.597 12.5-12.5V42.677l58.661 58.659c4.883 4.881 12.797 4.881 17.678 0 4.882-4.881 4.882-12.795 0-17.677z"></path></svg></div><div class="zptext zptext-align-center"><p>TOP</p></div></div>';
div.addEventListener('click',function(e){
e.preventDefault();
window.scrollTo(0,0);
})
document.body.appendChild(div);
}
window.onscroll = function() {
var threshold = 50; // Pixels after the scrol to top should show
scrollToTop.style.display = (document.body.scrollTop > threshold || document.documentElement.scrollTop > threshold) ? 'block' : 'none';
};
</script>