Home › Forums › JavaScript › Total Page Scroll Control › Reply To: Total Page Scroll Control
March 22, 2017 at 2:30 am
#253026
Shikkediel
Participant
when you scroll to a certain element (say #id) anchored link nav-link should become active – not done
Isn’t this the code at the bottom? Could be a bit shorter though – and you could combine it:
$(function() {
$('.scroll').click(function(e) {
$('.active').removeClass('active');
$(this).addClass('active');
var destination = $(this).attr('href');
e.preventDefault(); //-- the hell is this e --//
$('html, body').animate({
scrollTop: $(destination).offset().top
}, 750);
});
});