You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem with specifying a specific tab in the link. When you open https://domain.com/page/#tab-bar, the first tab shows, instead of the one specified in the hash.
Hi - I've literally just had to do this, thought id browse to see if anyone else had done it ('coz am lazy like that)
Put this in your footer (it's not pretty, but it works):
<script defer>
document.addEventListener("DOMContentLoaded", function (event) {
setTimeout(function () {
/* Set the active tab if hash in URL bar*/
if (window.location.hash.indexOf('#tab') === 0) {
document.querySelectorAll("a[href='" + window.location.hash + "'")[0].click();
}
}, 500);
});
</script>
Thx for code, but i dont understand for what you add if (window.location.hash.indexOf('#tab') === 0) cause on page i doesnt see any #tab id
maybe that will work better:
document.addEventListener("DOMContentLoaded", function (event) {
setTimeout(function () {
/* Check for valid hash in URL */
if (window.location.hash) {
/* Drop all GET parameters and use only hash*/
document.querySelectorAll("a[href='" + window.location.hash.split('?')[0] + "'")[0].click();
}
}, 500);
});
There is a problem with specifying a specific tab in the link. When you open https://domain.com/page/#tab-bar, the first tab shows, instead of the one specified in the hash.
For example link to page https://www.lotar.altervista.org/wiki/wiki/plugin/bootswrapper/nav#tab-bar right away goes to anchor "tab-bar", but when page is fully loaded, automatically opened first tab.
Can script check the hash after the page loads and open a specified tab?
The text was updated successfully, but these errors were encountered: