Highlight Current/Active Menu Using JQuery or Javascript


I recently wanted to convert the very basic menu on my Blogger site, to one that supported drop down menus. This was surprisingly easy to do due to the flexibility of Blogger and its built in customisation tools. Where it got tricky was highlighting the currently active menu item, but thanks to a good friend of mine Olie Mason, it was short work using JQuery. To see how it works, take a look at the menu items in this blog.

The step-by-step instructions provided below detail how to implement this in your Blogger blog, however the code examples provided should work elsewhere. The menu uses either JQuery or JavaScript to highlight the currently active page, otherwise the it is pure HTML and CSS, supporting 3 levels deep.

Download the standalone html version:


Using JQuery is a more elegant solution and requires far less code than the JavaScript equivalent. Open the HTML editor located under “Template” -> “Edit HTML”, and find the <head> tag. We will be inserting our script above this line.


Because we are using JQuery you will need to reference an online library if you haven’t already. I am using the following:


Next add the JQuery script:


Here’s what it looks like:


If you prefer JavaScript or do not want to reference the JQuery library, use the following script instead:


Here’s what it looks like:



Now we need to add some custom CSS to style the menu. You do this from “Template” -> “Customise” -> “Advanced” -> “Add CSS”. The below snippet should work for you, however you may need to customise to suit your page:

CSS Styles:



Lastly we need to add an HTML module to the navigation area in the template. From “Layout” settings, add a new gadget to the area you want the menu to be displayed. You may need to remove the default one before you can add your new one, just select “Edit” then “Remove” if that’s the case.

Select “Add a Gadget” and select “HTML/JavaScript”:

Leave “Title” empty, and paste the following code snippet in the “Content” box:

HTML Code:




Please enter your comment!
Please enter your name here