I have a website with onepage design: 4-5 classic menu links to anchor links. And in the menu i have a link to a contact page.
When i click to the contact page the other anchor links will be active but they dont go.
Can u help me?
// smooth anchor scrolling
jQuery('a[href*="#"]').on('click', function (e) {
e.preventDefault();
if(this.hash !== '') {
if(this.hash !== '' && this.href.replace(this.hash, '') == window.location.href.replace(window.location.hash, '')) {
var target = jQuery(this.hash);
if(target.length && this.hash !== '#') {
jQuery('html, body').stop().animate({
'scrollTop': target.offset().top
}, 1000, 'swing', function () {
if(this.hash !== '#') {
window.location.hash = target.selector;
}
});
}
}
}
});
// 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 !== '#') {
jQuery('html, body').stop().animate({
'scrollTop': target.offset().top
}, 1000, 'swing', function () {
if(this.hash !== '#') {
window.location.hash = target.selector;
}
});
} 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;
}
}
});