Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@brendanmckenzie
Created November 23, 2014 22:46
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendanmckenzie/8f8008d3d51c07b2700f to your computer and use it in GitHub Desktop.
Save brendanmckenzie/8f8008d3d51c07b2700f to your computer and use it in GitHub Desktop.
(function () {
'use strict';
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var id = $(this).parents('[role="tablist"]').attr('id');
var key = 'lastTag';
if (id) {
key += ':' + id;
}
localStorage.setItem(key, $(e.target).attr('href'));
});
$('[role="tablist"]').each(function (idx, elem) {
var id = $(elem).attr('id');
var key = 'lastTag';
if (id) {
key += ':' + id;
}
var lastTab = localStorage.getItem(key);
if (lastTab) {
$('[href="' + lastTab + '"]').tab('show');
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment