Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Bismin271172 committed Mar 25, 2024
1 parent 8652f3f commit 6391801
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ window.onscroll = () => {
navbar.classList.remove('open');
}


$('section').each(function(){
var top = $(window).scrollTop();
var id = $(this).attr('id');
var height = $(this).height();
var top = $(this).offset().top - 200;
if(top >= offset && top < height + offset){
$('.navbar ul li a').removeClass('active');
$('.navbar').find('[href="#' + id +'"]').addClass('active');
}
});
// $('section').each(function(){
// var id = $(this).attr('id');
// var height = $(this).height();
// var offset = $(this).offset().top - 200;
// var top = $(window).scrollTop();
// if(top >= offset && top < offset + height){
// $('.navbar ul li a').removeClass('active');
// $('.navbar').find('[data-scroll="#' + id +'"]').addClass('active');
// }
// });

0 comments on commit 6391801

Please sign in to comment.