Posted By

kanampo on 12/24/09


Tagged

menu jquery highlight active current


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jirimelcak


jQuery Highlight Navigation Menu v.01 Script


 / Published in: jQuery
 

URL: http://onerutter.com/css/jquery-highlight-tab-v01-javascript.html

  1. $(document).ready(function(){
  2.  
  3. // Highlight Tab v.01 by Jake Rutter
  4. // Website: http://www.onerutter.com
  5. // Feel free to use and adapt, please just give credit where credit is due.
  6. // ----------- highlight tab function -----------
  7. var path = location.pathname;
  8. var mediaString = location.search;
  9. var mediaPath = path + mediaString;
  10. var home = "/";
  11. $("a[href='" + [ path ] + "']").parents("li").each(function() {
  12. $(this).addClass("active");
  13. });
  14.  
  15. $("a[href='" + [ mediaPath ] + "']").parents("li").each(function() {
  16. $(this).addClass("active");
  17. });
  18.  
  19. });

Report this snippet  

You need to login to post a comment.