Skip to main content

Search and Top Navigation

#4506 closed enhancement (fixed)

Opened April 30, 2009 07:03PM UTC

Closed November 09, 2009 02:37AM UTC

tabs(): allow more flexibility in specifying what list is used

Reported by: cjwilks Owned by:
Priority: minor Milestone: 1.8
Component: ui.tabs Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

I would like to propose adding an option to ui.tabs that allows a person to more flexibly configure what ul should be used. That option would provide an alternate list element for the tab navigation bar. In the diff and usage example below, I've named the option ul.

#!diff

--- ui.tabs.js  Thu Apr 30 14:52:38 2009
+++ ui.tabs.js.2        Thu Apr 30 14:52:46 2009
@@ -71,7 +71,7 @@

        _tabify: function(init) {

-               this.list = this.element.children('ul:first');
+               this.list = this.options.ul || this.element.children('ul:first');
                this.lis = $('li:has(a[href])', this.list);
                this.anchors = this.lis.map(function() { return $('a', this)[0]; });
                this.panels = $([]);

Usage:

#!js
$("div#mytabs").tabs({
    ul: $("#someotherlist")  //use this other list as the tab nav
  });

In versions prior to 1.7.x the tabs() plugin targeted a ul directly. But the current code now expects a div that contains a ul as a direct child. This may fit in better with themeroller widget styles, but it does not always yield the layout a designer wants. (The ul may need to be wrapped in other intermediate elements, or it may need to be outside of the tab content pane entirely.)

Attachments (0)
Change History (5)

Changed May 07, 2009 01:06PM UTC by jzaefferer comment:1

milestone: TBD1.8

Sounds reasonable. Spec needed to decide how to handle this with regards to themes.

Changed May 07, 2009 01:09PM UTC by jzaefferer comment:2

Related to #4501.

Changed May 11, 2009 02:18PM UTC by klaus.hartl comment:3

resolution: → worksforme
status: newclosed

The ul does not need to be in the tab content pane at all.

Changed November 09, 2009 02:21AM UTC by scottgonzalez comment:4

resolution: worksforme
status: closedreopened

The ul does currently have to be a direct child of the container. We should be able to remove this restriction while still requiring the nav to be the first ul in the container.

Changed November 09, 2009 02:37AM UTC by scottgonzalez comment:5

resolution: → fixed
status: reopenedclosed

Fixed in r3421. The first descendant list found will be used now.