Commit fe10f619 authored by Thomas Löffler's avatar Thomas Löffler
Browse files

[FEATURE] Add tab handling via URL

* Open special tab via url (id)
* Change url when opening tab
parent 4f63d346
......@@ -283,6 +283,21 @@ $(function () {
$('.close-modal-btn').on('click', function () {
$('#membershipModal').modal('hide');
});
// accessing tab with url
var url = window.location.href;
if (url.indexOf("#") > 0) {
var activeTab = url.substring(url.indexOf("#") + 1);
$('.nav[role="tablist"] a[href="#' + activeTab + '"]').tab('show');
}
// change url when opening tab
$('a[role="tab"]').on("click", function () {
var newUrl;
const hash = $(this).attr("href");
newUrl = url.split("#")[0] + hash;
history.replaceState(null, null, newUrl);
});
});
$(window).on('load', function () {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment