How to change the color of fixed navigation links when it reaches a certain section?

Posted by thosetinydreams on Stack Overflow See other posts from Stack Overflow or by thosetinydreams
Published on 2013-11-11T13:22:12Z Indexed on 2013/11/11 15:54 UTC
Read the original article Hit count: 108

Filed under:
|
|
|

I'm trying to figure out how to change the color of the links in my fixed navigation (placed on the side of the page) when it reaches a certain section on the page (because the background of that section is the same color as the links in my navigation).

I am a jQuery newbie, so I don't really know how to go about this. I tried this, naively thinking it might work (but, as you guessed it, it didn't):

if ($('.fixednav').offset().top == $('.intro-section').offset().top) {
    $('.fixednav a').css('color', '#ececef');
}

If anyone could give me a hint, I'd be really grateful!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html