I’m trying to figure out how to generate tabs like jQuery’s tabs plugin, but without the swapping of DIVs. In other words, I’d like a jQuery plugin that just draws the tab bar (and lets me specify which tab is selected). I’ll take care of drawing the content and having things happen when tabs are clicked.
Share
All you have to do, is copy the classes that jQuery UI applies to the tabs, and you’re all set.
You’ll also then add/remove classes dynamically when the user clicks on one of them.
This is actually the way that jQuery UI does it with the tabs.
Here are some sample classes that they use:
I got these by inspecting the DOM after the jQuery UI has already applied the tabs functionality. Do the same, and you’ll see exactly what classes you need for which elements.
EDIT:
Here’s the complete HTML:
And here’s the Javascript:
And, of course, where would we be without the fiddle: http://jsfiddle.net/Bsa7J/ .