i know this is considered grave robbing a old thread but thought i would share this here as it is relevant.
this uses the latest development branch of jquery for version 1.9 have not tested this on the current stable release.
Tabbed Dialog without any heavy lifting, or creating any new widgets, ui plugins, or the like.
for the sake of this sample the element id is set to: tabdlg
CSS:
- #tabdlg.ui-tabs, #tabdlg.ui-dialog-content, #tabdlg.ui-dialog { padding: 0; }
javascript:
- $("#closer").button().click(function(){
$("#tabdlg").tabs().dialog("close");
});
$("#tabdlg").tabs().dialog({
autoOpen: false,
width: 600,
height: 400,
draggable: false, // disable the dialogs default drag we will be using the tabs titlebar instead
modal: true,
buttons: {
'Close': function() {
$(this).dialog('close');
}
},
open: function() {
$('.ui-dialog-titlebar').hide(); // hide the default dialog titlebar
},
close: function() {
$('.ui-dialog-titlebar').show(); // in case you have other ui-dialogs on the page, show the titlebar
}
}).parent().draggable(); // the ui-tabs element (#tabdlg) is the object parent, add these allows the tab to drag the dialog around with it
$("#tabopener").click(function(){
$("#tabdlg").tabs().dialog("open");
});
html:
- <button id="tabopener">Open Tabbed Dialog</button>
<div id="tabdlg">
<ul>
<li><a href="#ctabs-1">Tab One</a></li>
<li><a href="#ctabs-2">Tab Two</a></li>
<button id="closer" style="float: right;"><span class="ui-icon ui-icon-closethick" style="margin-right: .3em;"></span></button>
</ul>
<div id="ctabs-1">
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
</div>
<div id="ctabs-2">
<form>
<fieldset class="ui-helper-reset">
<label for="tab_title">Title</label>
<input type="text" name="tab_title" id="tab_title" value="" class="ui-widget-content ui-corner-all" />
<label for="tab_content">Content</label>
<textarea name="tab_content" id="tab_content" class="ui-widget-content ui-corner-all"></textarea>
</fieldset>
</form>
</div>
</div>
quirks:
1) clicking to drag is done from everywhere in the tabbeddialog. so selecting text will not happen except for form elements and the close button, oh and ofc the dialog resizer works as expected.
otherwise it works great. would be nice to have a proper tabbedDialog ui widget though but this is clean, simple and uses standard jquery calls without modifying the core widgets or having to extend either the tabs or dialog ui's