I have a dialog box that is called once an ajax call loads an image with an unknown size. I have a max height and max width. I have found similar issues, but the answers have not solved my problem. As of now I am taking the screen width and dividing it by 4 to set a X coordinate. Hoever this does not exactly center the window.
var windowWidth = $(window).width()
var modalCenter = windowWidth/4;
$("#userImage").dialog({
autoOpen: false,
modal: true,
width: 'auto',
create: function (event, ui) {
$(this).css("maxWidth", "700px");
},
height: 'auto',
maxHeight: 600,
show: { effect: 'fold', duration: 250 },
position: [modalCenter, 100],
buttons: {
Cancel: function () {
$(this).dialog("close");
},
Crop: function () {
var x = $('#x').val();
var y = $('#y').val();
var w = $('#w').val();
var h = $('#h').val();
if (!checkCoords())
return false;
$.ajax({
url: "CropImage.aspx?x=" + x + "&y=" + y + "&w=" + w + "&h=" + h,
cache: false
}).done(function (html) {
//another ajax call will get all images as a list and display them where they can be set as primary images/subImages
})
}
}
});
Here is an image: