Guest User

Untitled

a guest
Oct 21st, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. var wind = window;
  2. $(document).on("scroll", function(e){
  3. var sect = $(this).find('.sect');
  4. sect.each(function(i){
  5. if(wind.scrollY >= sect[i].offsetTop - 100 && wind.scrollY <= sect[i].offsetTop + 50){
  6. var ths = $(this)
  7. var id = ths.attr('id');
  8. var link = $('.my_mnu').find('.link');
  9. link.each(function(){
  10. var link_ths = $(this)
  11. var href = $(this).attr('href');
  12. var string = href.substr(1, href.length);
  13. if(id == string){
  14. link.removeClass('active');
  15. link_ths.addClass('active');
  16. }
  17. })
  18. }
  19. })
  20. })
Add Comment
Please, Sign In to add comment