Closed iNaD closed 9 years ago
Shouldn't your fallback hash be whatever tab is selected via "li.active > a"? That keeps it consistent with your CSS. Can you explain what situations you wouldn't want that behaviour? Thanks for your PR :)
Ok I'll try to explain step by step.
http://mypage.tld
tab-2
. URL is now http://mypage.tld#tab-2
tab-3
. URL is now http://mypage.tld#tab-3
http://mypage.tld#tab-2
again and tab-2 selectedhttp://mypage.tld
and the default tab should be selected, but it isn't, because the current li.active > a
is tab-2.The reason for that is, tab-2
has the .active
class and the default tab (e.g. tab-1
) hasn't. So you have some options to decide which one is the default tab:
active
class (current behaviour)When I did this PR I forgot that we could remember the initial selected tab just on initialization. Maybe I'll find the time to also add this feature.
I hope you understand the issue, what the current behaviour is and what the real behaviour should be.
Hi,
I updated the script. Now the default tab is remembered on initialization and used if no hash is given while you are going back in the history.
Can you see if this gist would work for you? https://gist.github.com/aidanlister/1d36815809977b21e0f0
Fixed now
Hey Aidan,
good job. Had to use your little helper again and it works fine. Sorry that I missed to answer.
Hi,
I needed a fallback if the user hits the back button and the hash changes to nothing. So now it's simply possible to call stickyTabs like this:
I also increased the version number and added a simple test.