In file gk.scripts.js the anchored links smooth scrolling works great, but leaves the anchored tag behind the main menu of the template, to fix that, I have modified the smooth anchor scrolling part a bit.
- Code: Select all
// smooth anchor scrolling
jQuery('a[href*="#"]').on('click', function (e) {
e.preventDefault();
if(this.hash !== '') {
var target = jQuery(this.hash);
if(this.hash !== '' && this.href.replace(this.hash, '') == window.location.href.replace(window.location.hash, '')) {
if(target.length && this.hash !== '#') {
window.location.href = target.selector;
jQuery('html, body').stop().animate({
'scrollTop': target.offset().top - 130
}, 1000, 'swing');
} else if(this.hash !== '' && this.href.replace(this.hash, '') !== '') {
window.location.href = this.href;
}
} else if(this.hash !== '' && this.href.replace(this.hash, '') !== '') {
window.location.href = this.href;
}
}
});
Basically I have added the line
- Code: Select all
window.location.href = target.selector;
Added a little ofset to the scrollTop param
- Code: Select all
'scrollTop': target.offset().top - 130
And removed the jQuery animate complete callback
- Code: Select all
, function () {
if(this.hash !== '#') {
window.location.hash = target.selector;
}
}
Hope it gets implemented.
Best regards!