Sean Catchpole wrote:

Klaus,

Since the div's that are being toggle all have IDs that means they are
unique, so why not search the document namespace instead of just the
containing div?

Sean, of course this is easily doable. When I first started the tabs I created an overall container because the list and the tabs containers are semantically one unit to me, thus that should be expressed via the HTML as well by a div wrapping up both building blocks (That is also the reason why I always chose an id like "container" as being non-presentational as opposed to "tabs", which is a completely presentational id).

I will consider that for Tabs 3. The only thing whats needed is actually just the list, I know. From there it's easy to get to the containers.

Requirement in this case was unfortunatly that the HTML cannot be changed. With the recently added increase in flexibility it could already work out with attaching a few classes.

You would just need to attach the relevant classes to the building blocks and then use *some* outer container as starting point. If the plugin doesn't find elements by the default structure it tries to find elements by class, so in the given example, assuming these elements are nested in the body:

<body>
  <div id="content">
    <div id="fragment-1" class="tabs-container">1</div>
    <div id="fragment-2" class="tabs-container">2</div>
    <div id="fragment-3" class="tabs-container">3</div>
  </div>
  <div id="sidebar">
    <ul class="tabs-nav">
      <li><a href="#fragment-1">One</a></li>
      <li><a href="#fragment-2">Two</a></li>
      <li><a href="#fragment-3">Tabs are flexible again</a></li>
    </ul>
  </div>
</body>

Initialization like that should work:

$('body').tabs();


-- Klaus

Reply via email to