I am using jQuery UI dialog to load ajax content. It correctly positions the dialog vertically, however with the option width: "auto" it does not center it horizontally. It is not centered, like 100px to the right of the center.
Here is my code:
$('.open').live('click', function(e) { e.preventDefault(); $("#modal").load($(this).attr('href')).dialog({ title: $(this).attr('title'), modal: true, autoOpen: true, draggable: false, resizable: false, width: 'auto', position: ['center', 'top'] }); });
Any ideas if there is a way to automatically resize and save in the center?
EDIT: This works:
$("#modal").load($(this).attr('href'), function() { $("#modal").dialog({ title: $(this).attr('title'), width: 'auto', modal: true, autoOpen: true, draggable: false, resizable: false, position: ['center', 150], create: function(event, ui) {} }); });
David source share