Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var wind = window;
- $(document).on("scroll", function(e){
- var sect = $(this).find('.sect');
- sect.each(function(i){
- if(wind.scrollY >= sect[i].offsetTop - 100 && wind.scrollY <= sect[i].offsetTop + 50){
- var ths = $(this)
- var id = ths.attr('id');
- var link = $('.my_mnu').find('.link');
- link.each(function(){
- var link_ths = $(this)
- var href = $(this).attr('href');
- var string = href.substr(1, href.length);
- if(id == string){
- link.removeClass('active');
- link_ths.addClass('active');
- }
- })
- }
- })
- })
Add Comment
Please, Sign In to add comment