My question is more complicated than I find posted here If element is over another element?
I have fixed position DIV and a lot of full width <section>
elements with classes .white and .yellow (every second). I need to detect whether DIV element is over .white or .yellow section when scrolling down.
<div style="position: fixed"> ... </div>
<section class="white"> ... </section>
<section class="yellow"> ... </section>
<section class="white"> ... </section>
<section class="yellow"> ... </section>
I want to add a class .whiteDIV to that DIV when it is over <section class="white">
and a class .yellowDIV when it is over <section class="yellow">
to have different styles on different backrounds.
Live demo can be find here: http://digitalmotion.lt/easymoney/. I need to change navigation colors when it is over different backgrounds.
How I do detect when that DIV is over .white or .yellow section? Do I need use .offset() function to get all my sections coordinates in array or is there another way to do this?