Moved doFancyExpensiveTabThings into the Skeleton namespace, and added support for multiple tab sets.

This commit is contained in:
Eric Kever 2011-08-10 15:01:06 -04:00
parent 553f2fa375
commit 89d54a83f2

View File

@ -99,17 +99,16 @@
var event = e || window.event;
return fn.call(element, event); //Force it to call the handler in the proper context (IE 7 & 8 do not)
}, last);
}
};
},
window.Skeleton = Skeleton;
})();
function doFancyExpensiveTabThings(){
doFancyExpensiveTabThings : function(){
var tabs = Skeleton.filterTags(Skeleton.getElementsByClassName(document, "tabs"), ["ul"]);
for(var i = 0, j = tabs.length; i < j; i++){
var tabList = tabs[i].getElementsByTagName("li");
(function(){
var tabNum = i,
tabList = tabs[tabNum].getElementsByTagName("li");
for(var k = 0, l = tabList.length; k < l; k++){
Skeleton.addListener(tabList[k].getElementsByTagName('a')[0], "click", function(e){
var contentLocation = this.href.substr(this.href.indexOf("#")) + "Tab",
@ -130,7 +129,8 @@ function doFancyExpensiveTabThings(){
Skeleton.addClass(this, "active");
contentElement = document.getElementById(contentLocation.substr(1));
//contentElement = document.getElementById(contentLocation.substr(1));
contentElement = Skeleton.getElementsByClassName(Skeleton.getElementsByClassName(tabs[tabNum].parentNode, "tabs-content")[0], contentLocation.substr(1))[0];
Skeleton.addClass(contentElement, "active");
siblings = contentElement.parentNode.getElementsByTagName('li');
@ -143,7 +143,12 @@ function doFancyExpensiveTabThings(){
return false;
});
}
})();
}
}
}
};
Skeleton.addListener(window, "load", doFancyExpensiveTabThings);
window.Skeleton = Skeleton;
})();
Skeleton.addListener(window, "load", Skeleton.doFancyExpensiveTabThings);