I’ve written — and lost — at least two reusable tab components in Javascript before. So I’m posting this one here as a reminder to myself to never, ever, ever write one of these again.
There are tons of HTML tabbing classes/functions/extensions/plugins/blahblah out there but almost every one I’ve ever found has been a plugin for [insert Javascript library here]. I don’t see a point in using [insert Javascript library here] just to have 3 tabs on a page, do you?
So here it is, a simple tab class with callbacks that could be extended to do all your tabbing needs at 1.7kb min’d. You could probably get that down to 1k if you really wanted to and didn’t need callbacks. What’s an extra 1.7kb in your Javascript file? You are including a single JS file instead of ten 5kb files, aren’t you?
Source/examples after the break.
» Read more: SimpleTabs: A pure javascript easy tab implementation

