Style link for current page
I'm using this to animate link color on hover...
- <script type="text/javascript">
- $(document).ready(function(){
- $(".hamenu a").stop().hover(function() {
- $(this).stop().animate({ color: "#a56a32" }, 500);
- },function() {
- $(this).animate({ color: "#5f6062" }, 1000);
- });
- });
- </script>
I now want to apply the hover color to the link that matches the current page.
I found this code...
- <script type="text/javascript" charset="utf-8">
- //<![CDATA[
- jQuery(function() {
- jQuery('.primary-nav a').each(function() {
- if (jQuery(this).attr('href') === window.location.pathname) {
- jQuery(this).addClass('current');
- }
- });
- });
- //]]>
- </script>
... but I need help integrating it into the animate code.
One issue I see is that applying a class will not override the 'style="#color' that get's applied to the href in the animate script, correct?