jQuery Automatically Highlight Current Page

jQuery Automatically Highlight Current Page is moved here http://www.allphptricks.com/jquery-automatically-highlight-current-page/

4 thoughts on “jQuery Automatically Highlight Current Page

  1. I just put this code in top auto content
    <html>
    <head>
    https://code.jquery.com/js/jquery-1.11.3.min.js

    $( function () {
    var pathname=(window.location.pathname.match(/[^\/] $/)[0]);
    $( ‘.navigation a’).each( function() {
    if ($(this). attr(‘href’)==pathname)
    {
    $(this).addClass( ‘active’);
    }
    });
    });

    <style type="text/css">
    #wrapper {margin :1px;}
    .navigation {padding :1px;}
    .navigation a {color:red; text-decoration:none;}
    .active{background:yellow; color:#530;}
    </style>
    </head>
    <body>

    </body>
    </html>

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s