Well, yes... I did it for the login form.
With the (working) code I gave you, you should be able to understand how to do it for the other elements you need... if you spend 2 minutes trying to understand what the code does IMO.
Which would be basically to add 2 lines for each element you need the same behavior in the resizeUI function...
Code:
$('#dialog2').css('top', winH/2-$('#dialog2').height()/2);
$('#dialog2').css('left', winW/2-$('#dialog2').width()/2);
And so on...
You just need to get the window size (width, height) and then to place each element on the page accordingly.
winH is your "window Height" so you set each element "top" css value to "half the window height -minus- half your element's height" (hence the /2) -> the same applies for the width.
Your code could actually be easier and cleaner... What about
:
Code:
$('#dialog1').css({
'top' : ((winH / 2) - ($('#dialog1').height() / 2)) + 'px',
'left' : ((winW / 2) - ($('#dialog1').width() / 2)) + 'px'
});
And the same applies to #dialog2 and any other element you want to center on your page.
There is a "thanks" button below this post...