I have a link to a tab (tab1, tab2, tab3), and at the bottom of the page there is a link to a link to the page for each tab.
to highlight tabs
$(document).ready(function(){
var str=location.href.toLowerCase();
$(".tabs li a").each(function() {
if (str.indexOf(this.href.toLowerCase()) > -1 ) {
$("li.highlight").removeClass("highlight");
$(this).parent().addClass("highlight");
}
});
})
to highlight a page
$(document).ready(function(){
var str=location.href.toLowerCase();
$(".paging li a").each(function() {
if (str.indexOf(this.href.toLowerCase()) > -1 ) {
$("li.hp").removeClass("hp");
$(this).parent().addClass("hp");
}
});
})
Although the link to the link and the link to the tab were correctly highlighted for each function, how can I highlight the current tab (after clicking the link to the page) and the current page at the same time? can i use the above functions?
thank!
source
share