Skip to content

Commit

Permalink
Fixed hashchange functionality to work with ajax tab structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
JangoSteve committed May 25, 2011
1 parent 687aa7d commit e6a69d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions javascripts/jquery.easytabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
$defaultTab = data.defaultTab,
$defaultTabLink = data.defaultTabLink,
hash = window.location.hash.match(/^[^\?]*/)[0],
$tab = $tabs.find("a[href='" + hash + "']");
$tab = $tabs.find("[href='" + hash + "'],[data-target='" + hash + "']").first();
if ( opts.updateHash ) {
if( $tab.size() > 0 ){
$container.data("easytabs").skipUpdateToHash = true;
Expand Down Expand Up @@ -418,7 +418,9 @@
if ( ($tab = $tabs.filter(tabSelector)).size() == 0 ) { // Find tab container that matches selector (like 'li#tab-one' which contains tab link)
if ( ($tab = $tabs.find("a[href='" + tabSelector + "']")).size() == 0 ) { // Find direct tab link that matches href (like 'a[href="#panel-1"]')
if ( ($tab = $tabs.find("a" + tabSelector)).size() == 0 ) { // Find direct tab link that matches selector (like 'a#tab-1')
$.error('Tab \'' + tabSelector + '\' does not exist in tab set');
if ( ($tab = $tabs.find("[data-target='" + tabSelector + "']")).size() == 0 ) { // Find direct tab link that matches data-target (lik 'a[data-target="#panel-1"]')
$.error('Tab \'' + tabSelector + '\' does not exist in tab set');
}
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion javascripts/jquery.easytabs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e6a69d1

Please sign in to comment.