rocket-3d/templates/assets/js/pages.js

20 lines
543 B
JavaScript
Raw Normal View History

2021-08-25 10:32:30 +02:00
$(document).ready(function(){
// Add smooth scrolling to all links with #
$("a").on('click', function(event) {
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 1000, function(){
// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
} // End if
});
});