I’m trying to link a button from one page to a section on my homepage
I found this script but feel I’m not using it properly
Could someone guide me on this?
<script>
$(document).ready(function() {
// Add smooth scrolling to all links
$("a").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Store hash
var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 2000, function() {
// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
return false;
} // End if
});
});
</script>
Here is my site Read-Only: LINK
(how to share your site Read-Only link)