.destory() not resetting height?
Having a problem in that each cycle of show / destroy increments the height of the dialog box by 16 pixels.
I initially had a problem with sizing not being correct when I use the simple method to load up dynamic content:
- function showDialog(divId,script)
- {
$(divId).load(script).dialog().siblings(".ui-dialog-titlebar").hide();
}
That doesn't work because dialog doesn't seem to see the size of the script that was loaded in. My solution was to use the ajax function first, then set width/height:
- function showDialog_save(divId,script)
- {
- $.ajax({
- url: script,
- cache: false,
- success: function(data){
- $(divId).html(data);
$(divId).dialog({
width: $(divId).width() + 60,
height: $(divId).height() + 50
}).siblings(".ui-dialog-titlebar").hide();
}
- });
- }
So I first put the data into the divId.html so I have something to measure with width/height. I then attach dialog to divId and set width / height accordingly. Tases great, less filling.
To close I destroy:
- function hideDialog(divId)
- {
- $(divId).dialog("destroy");
- }
I thought this command would set everything back to pre-inilitzation state, but the height just keeping growing and growing and growing. To check where it was coming from I added 3 lines before I called dialog:
- var divWidth = $(divId).width() + 60;
- var divHeight = $(divId).height() + 50;
- alert("height: " + divHeight);
The alert, in this case, starts at 245, then goes to 261, 277, 293, etc, etc. This happens in Firefox and IE.
IE8 on the other hand, messes up the width. The first cycle it's perfect ... all cusbquent cycles basically grab the full size (left-to-right) and just use that from that point forward.
This stuff is killing me. I just want to display my content in a modal / floating dialog fashion and I am thinking that dialog is overkill and it's the extra "kitchen sink" stuff that is causing an issue. I really don't want to declare hard sizes as I use em's on all my stuff anyways, so I really don't know what size it's going to be anyways due to a user maybe being zoomed in / out.
BTW, if I leave the title bar in, and use the "x" to close, I get a 50 x 50 box the next time. If I click on my "cancel" button, invoking the destroy, the width gets corrected, but the height is messed up.