javascript - Adding style to links, on active -
i'm trying style menu when links active.
i've got code use, not sure id's etc use, or how write css. css should maybe this?
#xx a.anchorlink.active { color: #fff; }
the website here: website
<!--active link, index--> <script type="text/javascript"> $(document).ready(function(){ $('#xx a.anchorlink').addclass('active'); }); </script> <!--active link, other pages--> <script type="text/javascript"> $(function() { $('a.anchorlink').click(function(e) { var $this = $(this); $("#xxx").load($this.attr('href')); $('a.anchorlink').removeclass('active'); $(this).addclass('active'); // prevent default link click e.preventdefault(); }) });</script>
i believe referring current page link being 'active'? pseudo state :active not work this. menu using class 'current-menu-item' applied li of active link style link use
.current-menu-item span {color:red;}
Comments
Post a Comment