forked from lix-project/hydra
When a tab is selected, change the fragment id
And when a page is visited, active the tab identified by the fragment id. This allows linking to a specific tab. Fixes #93.
This commit is contained in:
parent
afc90b36db
commit
68a03bc674
|
@ -85,6 +85,23 @@
|
||||||
bootbox.animate(false);
|
bootbox.animate(false);
|
||||||
|
|
||||||
$(".hydra-popover").popover({});
|
$(".hydra-popover").popover({});
|
||||||
|
|
||||||
|
/* Ensure that pressing the back button on another page
|
||||||
|
navigates back to the previously selected tab on this
|
||||||
|
page. */
|
||||||
|
$(function() {
|
||||||
|
$('.nav-tabs').bind('show', function(e) {
|
||||||
|
var pattern = /#.+/gi;
|
||||||
|
var id = e.target.toString().match(pattern)[0];
|
||||||
|
history.replaceState(null, "", id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
if (window.location.hash) {
|
||||||
|
$(".nav a[href='" + window.location.hash + "']").tab('show');
|
||||||
|
}
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue