Last active
May 15, 2017 13:01
-
-
Save johhansantana/6d1f05d27aad0ceb092c to your computer and use it in GitHub Desktop.
add navigation active as page scroll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$(window).scroll(function(){ | |
var windscroll = $(window).scrollTop(); | |
$('body .section').each(function(i){ | |
if ($(this).position().top <= windscroll){ | |
$('nav li.active').removeClass('active'); | |
$('nav li').eq(i).addClass('active'); | |
}; | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment