In Angular 6, on scrolling how to highlight navgation "li" item

Viewed 221

I am using Angular 6 and i have requirement where the user scrolls,based on the position of the scrollbar the related "div" containing link in the navigation bar should highlight. i have followed below link ,but none of the "else if" conditions are true, always the else part is executing so that the last link is highlighted always. This is because the "window.pageYoffset" value(scroller position value) is always very high than the "div's" offset value. so could you please provide me the solution where i am going wrong.

followed link :

Angular 6: How to highlight element on navbar depending on scroll?

0 Answers
Related