i have a web page that i want to load dynamically (ajax) into a jquery ui dialog. the page has multiple jquery tabs and when i load this into the dialog each tab is showing up as a regular link and the tab widget is not shown. Is this a known issue? Is there any workaround to support having jquery ui tabs inside of a dialog.
The jQuery UI dialog method is used to create a basic dialog window which is positioned into the viewport and protected from page content. It has a title bar and a content area, and can be moved, resized and closed with the 'x' icon by default.
Below is how I achieved a responsive jQuery UI Dialog. To do this, I added a new option to the config - fluid: true , which says to make the dialog responsive. I then catch the resize and dialog open events, to change the max-width of the dialog on the fly, and reposition the dialog.
With the latest versions of jQuery is not not trivial to select a tab by ID as it was before. $("#tabs"). tabs("option", "active", index); where index is the ordinal number counting tabs from left to right.
yes its possible. here is a simple example ...
JS Fiddle Example
You might want to add an open handler to retrieve your content and set up the tabs when you do so.
$(function() {
$('#dialog').dialog({
autoOpen: false,
modal: true,
buttons: {
'OK' : function() {
$(this).dialog('close');
},
'Cancel': function() {
$(this).dialog('close');
}
},
open: function(event,ui) {
$(ui.panel).find('div')
.load('http://www.example.com')
.find('.tabs')
.tabs();
}
});
$('.dialog-button').click( function() {
$('#dialog').dialog('open');
return false;
});
});
<div id="dialog" title="Dialog" style="display: none;">
<div class="dialog-content">
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With