Johan Dahl
Johan Dahl

Reputation: 1742

Targeting classes instead of ID with jQuery tabs

I want to use tabs on my page where clicking on each tab switches two panes instead of just one. Since ID´s are suppose to be unique, I can´t use ID´s on my panes and tabs. But just changing the hrefs and tabbed content to classes doesn´t work. How could I do this?

This is a dev page where I did get this working. However my tabs arent working at all in IE6-7 so I´m thinking about trying to use jquery ui tabs instead but that doesnt work.

http://johandahl.com/wp/malmocityfastigheter/testsida/

Upvotes: 1

Views: 736

Answers (2)

koral
koral

Reputation: 2955

You can switch first tabs set as usual by id and add event listener do 'select' event and in this listener change other tabs set(s).

Upvotes: 0

Jon
Jon

Reputation: 437376

Add to both of your tab panels a handler for the select event. This handler would look something like

function(e, ui) {
    var currentTabIndex = ui.index;
    $("selector that matches all tab panels").not(this)
        .tabs("select", currentTabIndex);
}

Upvotes: 1

Related Questions