I'm trying to set a class to active depending on the url. I'm trying to use the code below, but in every case, it activates the active class for the second tab.
var pathname = window.location.pathname;
if(pathname = '/learn/subsection2') {
$("ul.tabs li:eq(1)").addClass("active").show(); //Activate second tab
$(".tab_content:eq(1)").show(); //Show second tab content
} else {
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
}