-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically open tab in switcher with hash #968
Comments
+1! I've seen this in a few other projects and yes, that would be nice. In my projects I've only needed this to set the tab when a user reloads the page so had a simple workaround by storing the active page in the localstorage. |
I think it is the best approach for now to implement this functionality yourself. there are too many cases where you can't use the location hash as an identifier (hash based routing etc). |
The hash has become a bit abused for different things. I didn't like the way hash based routing made the anchor ability useless. But we have to deal with it. So although a hash in the URL would be most logical thing to do (ie. open the page at the anchor), I now agree with @aheinze that you should try and do it differently. |
I'm in need of this too, for a sign in form with a Help tab that needs to be active at load-time when Edit: I have this, so far. However, I can't switch back to the first tab. UIkit.switcher($('[data-uk-switcher]')).show($('li#help')); This is the markup: <ul class="uk-tab" data-uk-switcher="{connect:'#tabs'}">
<li id="session" class="uk-active"><a href="">New Session</a></li>
<li id="help"><a href="">Help</a></li>
</ul>
<ul id="tabs" class="uk-switcher">
<li id="session">...</li>
<li id="help">...</li>
</ul> |
url/#section-2 automatically set this li (2) as active and display blue content
url/#section-3 automatically set this li (3) as active and display green content
The text was updated successfully, but these errors were encountered: