Activate your free membership today | Log-in

Friday, March 3rd, 2006

Javascript Tabifier

Category: Programming, UI, Usability

Tabs have always been used to navigate across different parts of a website, but we're starting to see more of them appear in the middle of the page as well, where Ajax-style navigation is particularly compelling. So it's nice to see some libraries help with navigation. Javascript Tabifier is Patrick Fitzgerald's contribution. In the basic usage, you just wrap a div around each block, of CSS class tabbertab:

JAVASCRIPT:
  1.  
  2. <div class="tabber">
  3.  
  4.   <div class="tabbertab" title="Section One">
  5.     <h3>Section One</h3>
  6.     Section one content.
  7.   </div>
  8.  
  9.   <div class="tabbertab" title="Section Two">
  10.     <h3>Section Two</h3>
  11.     Section two content.
  12.   </div>
  13.  
  14. </div>

Since the content is just a continuous collection of divs, it gracefully degrades nicely.

Another tab library is Tabtastic - any others?

Posted by Michael Mahemoff at 12:05 pm

++++-
4.1 rating from 55 votes

20 Comments »

Comments feed TrackBack URI

Yeah, that is really graceful, and it doesn’t have this weird issue in Tabtastic, where the page scrolls down after I click on the final tab.

Comment by Joe Grossberg — March 3, 2006

A nice feature to add to TabTastic (created in 2004 there I might add, according to the copyright,) would be to monitor the hash/navigation of the URL so the tabs will change with use of the back/foward buttons. Looks like all the base work for it is there.

Comment by Scott Schiller — March 3, 2006

Here’s an older implementation of tabs

http://webfx.eae.net/dhtml/tabpane/tabpane.html this is the library the Mambo/Joomla! CMS has chosen to use.

Comment by Raymond Olavides — March 3, 2006

I’m not a huge fan of MS and Windows, but this is nice and smooth:
http://www.dhtmlgoodies.com/scripts/tab-view/tab-view.html

Comment by Daniel — March 3, 2006

Thanks for the link. One of my goals was to provide printing support: in all the other tabifiers I have seen, if you print the page, you only get the currently displayed tab.

Comment by Patrick Fitzgerald — March 3, 2006

http://www.onlinetools.org/tools/domtabdata/ - proba

Comment by Jack — March 3, 2006

Another example: http://silverhillfeathers.com/ - the script for it is here: http://silverhillfeathers.com/tabs.js

For a while, our company (webworks.ie) used this method to provide quick “multiple page” websites for clients.

http://truwood.ie/Clients - another one using the same library.

Kae

Comment by Kae Verens — March 4, 2006

here is a more generic approach that tabs are a special case of:

Panels / perspectives

Comment by Jean-Marc Orliaguet — March 4, 2006

Pity you didn’t post this a couple of weeks ago, it would have saved me writing this widget myself.

Comment by Dotan Dimet — March 4, 2006

I rolled my own at
http://www.akrabat.com/dynamic-javascript-tabs/

Comment by Rob... — March 5, 2006

Quite OK, however, I wanted to maintain a navigation even for non-JavaScript users, which is why I re-use the anchor -> named anchor thing in DOMtab (which is linked above anyways) :-)

Comment by Chris Heilmann — March 6, 2006

@Chris: indeed, I really liked your DOMtab implementation (and it’s giving me ideas for more features to add to mine). I can see the need for the non-JavaScript links, but my goal was to make setup as quick and painless as possible, so I wanted to avoid having to create a list and anchors.

Comment by Patrick Fitzgerald — March 6, 2006

Unlike other examples, this one requires server roundrip for every tab. In uses Ajax for in-place update if Javascript+XHR are available. Otherwise use good old redirection to composite page. Voila, dual-mode tab component.

Example: http://jroller.com/page/javadujour?entry=tabbed_notebook_component_got_simpler
Live demo: http://www.superinterface.com/jspcontrols/tabcontrol/index.jsp

Comment by Michael Jouravlev — March 7, 2006

[...] Patrick Fitzgerald posted a nice screencast explaining how he diagnosed and fixed an IE memory leak in his tabifier library. He walks through using the free tool Process Explorer to watch IE’s memory grow with each page refresh. He writes: This screencast discusses how I diagnosed and fixed a memory leak in a JavaScript library. It’s a very simplified example, and the same techniques probably can’t be used for more complex web applications, but it might shed some light on how these memory leaks occur. [...]

Pingback by Ajaxian » Screencast on Diagnosing Memory Leaks in IE — March 31, 2006

I like your site.
Blogs with comments windows that you have to click to open keep the dialogue under wraps. Blogs like this one which string comments out in the open are much more proactive about sparking dialogue.

Comment by Tim — April 11, 2006

Is it possible to load only the main page at first. Then load the hidden pages on mouse click using tabertab js?

Comment by Peter — February 6, 2007

I’ve been looking for and trying out many tab scripts, but yours is making it at the top of my short list at the moment.

Ok, first, a disclaimer: I’m a Javascript ignoramus. All I can do is download scripts, figure out how the darn thing is supposed to work, monkey here, monkey there and voila! I don’t know how it works, but hey, it works.

One thing still buggers me with your tabifier: I would like to find a way to get rid of the tooltip that gets displayed when the user mouses over each tab’s container - while keeping a full title, instead of numbers for the tabs.

Any idea?

Also, how hard would it be to implement tab selection persistence?

In any case, congrats and thanks for a very cool (and easy on idiots like me) piece of work!

Comment by Naturalalternativecialis — July 3, 2007

wow naturalaternaicilis how can you admit to something like that? :)

Comment by kopi — April 18, 2008

http://www.barelyfitz.com/projects/tabber/
You can also use this
R&I giving up smoking

Comment by kopi — April 18, 2008

Yes ajaxian. This tool is very useful for the AJAX developer.
Sometime we have difficulty with the formatting that make the code hard to be read.
- yuhirocks from stopping premature ejaculation

Comment by yuhirocks — October 3, 2008

Leave a comment

You must be logged in to post a comment.