mirror of
https://github.com/dawidolko/Website-Templates.git
synced 2025-10-28 00:03:10 +01:00
18 lines
482 B
JavaScript
18 lines
482 B
JavaScript
$(function() {
|
|
$('a[href*=#]:not([href=#])').click(function() {
|
|
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|
|
|| location.hostname == this.hostname) {
|
|
|
|
var thisItem = $(this.hash);
|
|
thisItem = thisItem.length ? thisItem : $('[name=' + this.hash.slice(1) +']');
|
|
if (thisItem.length) {
|
|
$('html,body').animate({
|
|
scrollTop: thisItem.offset().top
|
|
}, 1000);
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
|
|
});
|