Skip navigation
Currently Being Moderated

Assign a value for each Spry Tabbed Panel

Sep 21, 2011 12:54 AM

I have a page with spry tabbed panels grouped by the year and inside each panel are news articles for that year. When the user clicks to an article, there is a back button which links back to the previous page with the year tabs, with the relevant tab opened using However, is it possible for each tab to be assigned a value (tab=2011) as the tab=0 method would cause issues for future maintenance when there are additional articles from different years.


Thanks in advance.

  • Currently Being Moderated
    Sep 21, 2011 1:19 AM   in reply to wallflowerr83

    Hard to tell without seeing any code, but have you tried giving an ID to your panels like 'y2011' and opening them with the ID instead of their index? (See ml)

    Mark as:
  • Currently Being Moderated
    Sep 21, 2011 2:11 PM   in reply to wallflowerr83

    Why don't you do this?


    Leave the tab index alone.


    Pass the year in the url i.e. ?tab=2010


    Via URL utils get the value of the year


    var params = Spry.Utils.getLocationParamsAsObject();


    // Convert year to relevant tab index using earliest year as base.

    if (

    {var tabindex = - 2010;}


    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab: tabindex ? tabindex : 0});

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points