Created
December 8, 2010 22:35
-
-
Save walterdavis/734045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var box = $('item9'); | |
var tabs = box.select('h3'); | |
var bodies = box.select('p'); | |
var tab_color = '#ccc'; | |
var selected = '#dd9'; | |
tabs.invoke('setStyle','display:inline; padding:4px 8px; background-color:' + tab_color + '; margin:0; cursor:pointer'); | |
bodies.each(function(elm){ | |
elm.hide(); | |
elm._tab = elm.previous('h3'); | |
box.insert({bottom:elm.remove()}); | |
}).first().show(); | |
tabs.first().setStyle({backgroundColor: selected}); //selected tab color | |
tabs.invoke('observe','click',function(evt){ | |
bodies.invoke('hide'); | |
tabs.invoke('setStyle',{backgroundColor: tab_color}); | |
var tab = this; | |
tab.setStyle({backgroundColor: selected}); | |
var bods = bodies.findAll(function(elm){ | |
return elm._tab == tab; | |
}); | |
bods.invoke('show'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment