2

I have a wordpress site with jQueryUI tabs applied to two different elements of the same page. However, I want one of those elements themed and the other one not.

I tried using .removeClass('ui-widget') but of course it removes the class after applying the jQueryUI, so it's the same as doing nothing.

Another way of solving this could be apply the theme to only one tab, but I also don't know how to do that.

Thanks in advance.

3 Answers 3

1

What do you mean with "Not themed"?jQuery UI tabs are always themed. If you want to differentiate the two different sets of tabs you coul apply your own custom _CSS that overrides your UI theme. This is the markup created by tabs (taken from the docs)

<div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
   <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
     <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1">Nunc tincidunt</a></li>
      <li class="ui-state-default ui-corner-top"><a href="#tabs-2">Proin dolor</a></li>
   <div class="ui-tabs-panel ui-widget-content ui-corner-bottom" id="tabs-1">
      <p>Tab one content goes here.</p>
   </div>
    ...
</div>

Note: This is a sample of markup generated by the tabs plugin, not markup you should use to create a tabs. The only markup needed for that is

<div id="tabs">
   <ul>
      <li><a href="#tabs-1">Nunc tincidunt</a></li>
      <li><a href="#tabs-2">Proin dolor</a></li>
      <li><a href="#tabs-3">Aenean lacinia</a></li>
   </ul>
   <div id="tabs-1">
      <p>Tab 1 content</p>
   </div>
   <div id="tabs-2">
      <p>Tab 2 content</p>
   </div>
   <div id="tabs-3">
      <p>Tab 3 content</p>
   </div>
</div>.

you can use the id of the element to style things.

#tabs ul li{
   background-color: green;
}
Sign up to request clarification or add additional context in comments.

Comments

0

Tried this?:

 $(tab_not_theme).removeClass('ui-tabs'); 
 $(tab_not_theme).removeClass('ui-tabs-nav');  
 $(tab_not_theme).removeClass('ui-tabs-panel'); 

1 Comment

Jquery can add the ui classes at runtime
0

Each widget is a little different, but most of them have a destroy method. For example, to remove styling and behavior from a button widget:

$("#yourButton").button("destroy");

Another option is to override the css classes for that particular element. This will not affect the widget behavior.

#yourelement .ui-tabs .ui-button
{
    color: red;
}

2 Comments

This does not only remove the styling but the behavior as well. I destroys the plugin instance completely, restoring the original markup.
Right, I was under the impression that's what the OP wanted. I added another option using css overrides that will only affect style and not behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.