Please visit the link.
Try clicking the "Portfolio" link, it should be highlighted in blue.
But after clicking on the navigation bar, it will be highlighted in blue.
$('nav a').on('click', function() {
var scrollAnchor = $(this).attr('data-scroll'),
scrollPoint = $('section[data-anchor="' + scrollAnchor + '"]').offset().top;
$('body,html').animate({
scrollTop: scrollPoint
}, 500);
return false;
});
$(window).scroll(function() {
var windscroll = $(window).scrollTop();
if (windscroll) {
$('section').each(function(i) {
if ($(this).position().top <= windscroll) {
$('nav a.active').removeClass('active');
$('nav a').eq(i).addClass('active');
}
});
}
}).scroll();
source
share