I have navigation tabs, and when the user clicks the tab, the div changes using ajax. I would like him to remember which tab the user was on when the user changes the page. I havent made a navigation tab, and I'm brand new to javascript / jquery. Here is the javascript for the tabs:
jQuery('#contentContainer #tabNavi .nav-item').each(function(i, item) {
jQuery(item).bind('click', function() {
if (jQuery('a', this).hasClass('activeTab')) {
return;
} else {
jQuery('#contentContainer #tabNavi .nav-item' a').removeClass('activeTab').eq(i).addClass('activeTab');
channel_id = jQuery('a', this).attr('href').split('
if (channel_id == _channel) {
return;
}
}
})
});
Navigation links are as follows:
<li><a href="#39">Link1</a></li>
<li><a href="#53">Link2</a></li
Now I have the href value stored in the cookie, but I don’t know how I can change the active class to the right li element when the user comes to the page and he was there before and he clicked on some tab.
source
share