Reviewing other posts such as Scroll to error or top of page on submit and others, I have tried adding this onclick line to my button. The button is located where I want and looks good but it doesn’t scroll to the top of the page when clicked.
Anyone have a quick solution? I bet it is easy but I can’t find any direct match to my need in the the Community posts.
I have tried this from W3schools.com as well:
function topFunction() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}
Button CSS
.top-button-float {
/*display: none; Hidden by default /
position: fixed; /Fixed/sticky position/
bottom: 100px; /Place the button at the bottom of the page/
right: 20px; /Place the button 30px from the right/
border: 1px solid #ccc; /Border/
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /Shadow effect/
transition: transform 0.3s ease; /Smooth transition/
padding: 10px;
border-radius: 5px;
z-index: 1000; / Higher value to stay above other elements */
background-color: black !important;
}


