Hey,
I would like to achieve something like this:
http://jsfiddle.net/gUWdJ/3/ for this website i’m working on: http://oandg.co.uk.s156312.gridserver.com/
I have managed to get it partially working but for the “home” section it still highlights ‘About Us’
$(‘nav a’).on(‘click’, function() {
var scrollAnchor = $(this).attr(‘data-scroll’),
scrollPoint = $(‘section[data-anchor=”‘ + scrollAnchor + ‘”]’).offset().top – 28;
return false;
})
$(window).scroll(function() {
var windscroll = $(window).scrollTop();
if (windscroll >= 1000) {
$(‘body section’).each(function(i) {
if ($(this).position().top <= windscroll - 1000) {
$(‘nav a.active’).removeClass(‘active’);
$(‘nav a’).eq(i).addClass(‘active’);
}
});
} else {
$(‘nav a.active’).removeClass(‘active’);
$(‘nav a:first’).addClass(‘active’);
}
}).scroll();