jQuery Highlight Navigation Menu v.01 Script


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your 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. });

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.