local storage - How do I keep the current tab active with twitter bootstrap after a page reload? With typescript? -
i want how keep current tab active twitter bootstrap after page reload? of type script.how can this.my issue same :-
[1]: how keep current tab active twitter bootstrap after page reload? want typescript.how can i?
but want typescript.how can i
lucky typescript superset of javascript : https://basarat.gitbooks.io/typescript/content/docs/javascript/recap.html
so code sample https://stackoverflow.com/a/10524697/390330 works just fine
// bootstrap 3 use 'shown.bs.tab', bootstrap 2 use 'shown' in next line $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { // save latest tab; use cookies if 'em better: localstorage.setitem('lasttab', $(this).attr('href')); }); // go latest tab, if exists: var lasttab = localstorage.getitem('lasttab'); if (lasttab) { $('[href="' + lasttab + '"]').tab('show'); }
note: didn't use wrapping function hope using modules. more : https://basarat.gitbooks.io/typescript/content/docs/project/modules.html
Comments
Post a Comment