2

I have jquery sticky.js script to stick menu on scroll.

I want to change font color when sticky element .is-sticky, and back to normal color when .is-sticky is removed.

So i have this markup

<div id="sticky-wrapper" class="sticky-wrapper **is-sticky**">
    <div id="menu">
        <ul class="menu">
            <li><a href="#" title="xxx">XXX</a></li>
            <li><a href="#" title="xxx">YYY</a></li>
            <li><a href="#" title="xxx">ZZZ</a></li>
        </ul>
    </div>
</div>

CSS

#sticky-wrapper .menu > li > a {color: #fff;}
#sticky-wrapper > .is-sticky .menu > li > a {color: #000;}

Does not work... Or maybe css will not support this case correctly?

EDIT. IMHO it's not the same question, and example case is better to understand for beginners.

PipBoy2000
  • 440
  • 7
  • 21

1 Answers1

1

Change css rule to

#sticky-wrapper.is-sticky .menu > li > a {color: #000;}
programtreasures
  • 4,250
  • 1
  • 10
  • 29