Reputation: 133
With jQuery UI 1.10.4 its working fine, but with jQuery UI 1.11.1 it´s not working.
Dialog positioning with jQuery UI:
# working with 1.10.4
$(document).on('click', '.recenter', function () {
$('#myDialog').dialog("option", "position", { my: 'center', at: 'center' });
});
# not working with 1.11.1
$(document).on('click', '.recenter', function () {
$('#myDialog').dialog("option", "position", { my: 'center', at: 'center' });
});
Is this a bug in the new version, or am I using it wrong?
Edit:
$(document).on('click', '.recenter', function () {
$('#myDialog').dialog("option", "position", { my: 'center', at: 'center', of: window });
});
It seems that there is a default-reference problem. Its working fine with the code above.
Upvotes: 1
Views: 2369
Reputation: 1071
It appears that some "unofficial" values for position that used to work now no longer work. There are lots of examples on the net of using position: "center", for example, and this works on 1.10.4 (whether it works because it actually works or is being ignored and using the default). The documentation states that the default is position: { my: "center", at: "center", of: window }. It seems that specifying "center" or an incomplete definition now defaults to top left positioning when used during creation of the dialog, or is ignored when attempting to reposition.
http://api.jqueryui.com/dialog/#option-position
Upvotes: 2