Basically on my site I have a sticky nav that has a transparent background. Below that I have light or dark colored content divs.
What I'm trying to achieve is as you scroll, a javascript function is actively determining if the sticky nav is on top of a light or dark content div, based on that div's classname (or a data attribute, whichever), and changing the color of the text in the sticky nav so it's visible over the content div.
Currently I don't have any javascript started as I don't know how to detect if one div is over another. But as you can see, once the sticky nav is over a dark content div I need to change the font color to a lighter color, and once it's back over a light content div I need to change the color to a darker color.
Example HTML:
<div id="sticky">Menu</div>
<div class="content light"></div>
<div class="content dark"></div>
<div class="content light"></div>
<div class="content dark"></div>
<div class="content light"></div>
Thanks in advance!