Created
October 22, 2010 00:59
-
-
Save revans/639719 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tab Highlighting Function | |
// | |
// Usage: | |
// | |
// $(document).ready(function(){ | |
// $.tab_highlight(); | |
// }); | |
// | |
(function($) { | |
$.tab_highlight = function() { | |
$.tab_highlight.init(); | |
} | |
$.extend($.tab_highlight, { | |
init: function() { | |
var current_path = location.pathname; | |
$(".tab_highlight").each(function() { | |
var anchor_path = $(this).children().first().attr('href'); | |
if(anchor_path == current_path) { | |
$(this).addClass('active'); | |
} else { | |
$(this).removeClass("active"); | |
} | |
}); | |
} | |
}); | |
$.fn.tab_highlight = function() { | |
$.tab_highlight.init(); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment