Scroll to Top of Page on Tab Click
Automatically scroll a user to the top of page on a tab change on your Webflow site. A simple Javascript code snippet that allows for you to scroll users to the top of your site based on your selected class.
Automatically scroll a user to the top of page on a tab change on your Webflow site. A simple Javascript code snippet that allows for you to scroll users to the top of your site based on your selected class.
How to add it
- Add Javascript code snippet to closing body custom code
- Update class name to the element you want users to scroll to top on click
The code
Javascript
<!-- Add to body close section -->
<script>
$(".your-tab-class").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
</script>