104
rated 0 times
[
111]
[
7]
/ answers: 1 / hits: 12825
/ 11 Years ago, mon, january 20, 2014, 12:00:00
Hello I'm having some trouble trying to save the current selected tab when the page is reloaded,
I have a bootstrap 3.0 nav nav-tabs setup as my markup, like this:
<ul class=nav nav-tabs id=feedtab>
<li class=active id=atlasstab><a href=#atlass onclick=swapfeeds(1); data-toggle=tab>Atlass</a></li>
<li id=aviationtab><a onclick=swapfeeds(2); href=#avi data-toggle=tab>Aviation</a></li>
<li id=ittab><a onclick=swapfeeds(3); href=#proc data-toggle=tab>IT&S</a></li>
<li id=processingtab><a onclick=swapfeeds(4); href=#it data-toggle=tab>Plan&Proc</a></li>
</ul>
I am storing the lastactive variable into a cookie, the values are correct so it seems my jquery is incorrect, I'm simply trying to set the active tab to the corresponding 'lastactive' variable, IE : 1, 2, 3, 4
I'm aware that tab index starts at zero so i tried to increment the value +!, but still not working, can someone point out my problem?
this is the javascript im using to try set the active tab:
var lastactive = $.cookie(lastactive) != undefined ? $.cookie(lastactive) : 1;
$(document).ready(function() {
$(#feedtab).tabs({active: lastactive + 1 });
});
More From » jquery