Skip to content
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

Tabs - History #203

Closed
adampatterson opened this issue Sep 13, 2011 · 3 comments
Closed

Tabs - History #203

adampatterson opened this issue Sep 13, 2011 · 3 comments

Comments

@adampatterson
Copy link

Looking at Bootstrap JS 1.3 WIP

It would be nice if you could link to a tab

Example:

index.html#tab3 when loaded would show the 3rd tab.

If you navigated from Tab 3 to 4 then it would also be nice if the back button took you to Tab 3, Much like the ScrollSpy.

Great work!

@luxuryluke
Copy link

That's a great idea, and a useful feature.

@fat
Copy link
Member

fat commented Sep 14, 2011

Unfortunately tabs present a much more challenging problem then the scrollspy plugin. Scrollspy checks scroll position and sets active state based on that (including page load). In browsers when you hit the back button (a hashchange) event is fired and you get scrolled to a previous position -- the scroll fires a scroll event, and we reset the active state to the correct place. Easy enough.

With tabs the scroll position doesn't change because the content is being toggled in place.

A work around is to manually check for a :target element on the page and to listen to the hashchange event for updates. The main problem with this approach is the hashchange event isn't supported by ie7. (which bootstrap needs to support)

I wrote up a quick implementation of what this might look like however for those interested: https://gist.github.com/1217433

You can probably extend this with ben almans hashchange event plugin (which does pulling to look for a hashchange)

However, because of the lack if ie7 support -- and because i don't want to add a pulling timeout to a plugin like this - i don't believe we will be supporting hash based navigation.

Thanks for bringing it up however,and i hope that gist provides you with what you need to get something working if you feel you really need it. cheers!

@fat fat closed this as completed Sep 14, 2011
daveobriencouk pushed a commit to egocreative/bootstrap that referenced this issue Nov 18, 2012
daveobriencouk pushed a commit to egocreative/bootstrap that referenced this issue Nov 18, 2012
Lengthy previous discussion in twbs#203

Close twbs#926
Close twbs#1033
pbrit pushed a commit to pbrit/bootstrap that referenced this issue Jul 2, 2013
@cvrebert
Copy link
Collaborator

X-Ref: #2415

phaseOne pushed a commit to phaseOne/bootstrap that referenced this issue Apr 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants