Ticket #4506 (closed enhancement: fixed)

Opened 6 years ago

Last modified 5 years ago

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:
Blocking: Blocked by:

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.

  • ui.tabs.js

    old new  
    7171 
    7272       _tabify: function(init) { 
    7373 
    74                this.list = this.element.children('ul:first'); 
     74               this.list = this.options.ul || this.element.children('ul:first'); 
    7575               this.lis = $('li:has(a[href])', this.list); 
    7676               this.anchors = this.lis.map(function() { return $('a', this)[0]; }); 
    7777               this.panels = $([]); 

Usage:

$("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.)

Change History

comment:1 Changed 5 years ago by joern.zaefferer

  • Milestone changed from TBD to 1.8

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

comment:2 Changed 5 years ago by joern.zaefferer

Related to #4501.

comment:3 Changed 5 years ago by klaus.hartl

  • Status changed from new to closed
  • Resolution set to worksforme

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

comment:4 Changed 5 years ago by scott.gonzalez

  • Status changed from closed to reopened
  • Resolution worksforme deleted

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.

comment:5 Changed 5 years ago by scott.gonzalez

  • Status changed from reopened to closed
  • Resolution set to fixed

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

Note: See TracTickets for help on using tickets.