I've seen questions similar to this but haven't found an answer for my situation. I've created a simple modal popup plugin using jQuery that runs like this:
$('#popup').popupElement("http://www.example.com #somediv");
It loads divs from another website when the selector #popup is clicked. The click function looks like this:
$(thisObj).click(function(e){
e.preventDefault();
$("#popupDiv").load(div);
centerPopup();
loadPopup();
});
The problem is when it loads the external div into the popupDiv, the popupDiv's height and width are 0, so centerPopup() can't center it right. After clicking the #popup link a few times the popupDiv's dimensions fix themselves. Is there a way to ensure the popupDiv gets set to the right dimensions before centerPopup() is called?