Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
common
t3olayout
Commits
fe10f619
Commit
fe10f619
authored
Apr 04, 2022
by
Thomas Löffler
Browse files
[FEATURE] Add tab handling via URL
* Open special tab via url (id) * Change url when opening tab
parent
4f63d346
Changes
1
Hide whitespace changes
Inline
Side-by-side
Build/Assets/JavaScript/main.js
View file @
fe10f619
...
...
@@ -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
()
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment