Versions: jQuery 1.3.2 with jQuery UI 1.7.1
Use case: size a dialog's height so that when the browser window is
resized, the dialog resizes to fit vertically on the page.
Problem:
setting the height option and setting the "height.dialog" property
programmatically do not end up having the dialogs _resize method
invoked. As a result the dialog is resized, but the content is not
Code to reproduce (page_help_icon is just a DIV that can be clicked on
to open a help dialog):
$( function()
{
$('#page_help_icon').click( function(event)
{
var $help = $('#page_help');
if ($help.length == 0)
{
var resizeFunc = function (event)
{
$help.dialog('option', 'height', $('body').innerHeight() - 40)
.dialog('option', 'position', 'center');
};
$help = $('<div id="page_help" ></div>').appendTo($('body'))
.dialog({ autoOpen: false, title: 'Help', width: 900,
open: function() { $(window).resize(resizeFunc); },
close: function() { $(window).unbind('resize',
resizeFunc); } });
}
// set content of the help dialog here. Test code:
$help.empty().append($('aoeu<br/>aoeu<br/>aoeu<br/>aoeu<br/>aoeu<br/
>aoeu<br/>aoeu<br/>aoeu<br/>aoeu<br/>aoeu<br/>aoeu<br/>aoeu<br/
>aoeu<br/>aoeu<br/>'));
$help.dialog('option', 'height', $('body').innerHeight() - 40)
.dialog('option', 'position', 'center').dialog('open');
});
});
I have also tried using:
$help.data('height.dialog', $('body').innerHeight() - 40)
instead of:
$help.dialog('option', 'height', $('body').innerHeight() - 40)
Neither work. In both cases the contents do not resize, only the
outside of the dialog.
I can't find a work-around either as I have yet to find a way to get
access to the hidden _size() method.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---