Answer the question
In order to leave comments, you need to log in
Is there a trick to make a specific tab(s)(tab$) active when the browser opens a specific address .html#tab$?
There is an HTML page. The main content is placed in tabs, which are implemented through anchors and links to these anchors. With the help of JS, by clicking on the links, they add and remove the active class, which is assigned styles for the active tab in CSS. When saving a page in favorites or directly accessing a
certain section of the page ending in .html#tab$, the current tab is not active because there was no click. Is there a trick to make it active during a direct entry to a certain section of the village.
Answer the question
In order to leave comments, you need to log in
Something in recent days, too many people interested in the hash ....
var lH = location.hash; //#tab$
//Ну и что-то с этим делайте
If you are using bootstrap and jquery you can do this:
var hash = document.location.hash;
$('.nav-tabs a[href=#' + hash + ']').tab('show');
window.location.href chop off the desired piece after .html and look for the desired selector
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question