html5 - Change Nav Label Color Using CSS -
trying work out active state nav issue single-page website comprised of series of content slides. slides html5 sections, each discreet id.
i found js solution insert active state main navigation here. nav menu in fixed-position sidebar.
however, have pictogram nav elements @ top , bottom of each slide can used scroll next / previous slide. these not trigger click event js looks for.
any ideas on how insert active state when clicking on pictograms, well?
here's current js:
<script> $(document).ready(function () { $('#mainnav ul li a').on("click", function () { $(this).parent().siblings().find("a").removeclass('active'); $(this).addclass('active'); }); }); </script> here's main nav, again in fixed position sidebar:
<nav role="navigation"> <div id="mainnav"> <ul class="mainnavcontainer clearfix"> <li class="mainnavrows"><a href="#foo1" title="">foo 1</a></li> <li class="mainnavrows"><a href="#foo2" title="" >foo 2</a></li> <li class="mainnavrows"><a href="#foo3" title="" >foo 3</a></li> etc... </ul><!--end mainnavcontainer--> </div><!--end mainnav--> </nav> here's basic structure of slides. includes pictogram nav elements target same ids main nav does:
<section id="foo1"> <!--pictogram nav element referencing prev slide (if exists)--> <div class="abovescroll"> <a href="#background"><span class="icon"></span></a> </div> ...slide content... <!--pictogram nav element referencing next slide (if exists)--> <div class="bottomscroll"> <a href="#believe"><span class="icon"></span></a> </div> </section> etc...
Comments
Post a Comment