开发者

Change the position of a jquery dialog box after it loads

I have a jquery dialog box that loads with an image and auto resizes to the image. This is what I want. However, the box is rendered at the center position, but the image isnt fully loaded yet, there is a delay in getting the image. So when the image is loaded into the dialog box the upper left corner is centered, but the whole bottom right extends further down and right sort of skewed to the side. I know this is because the box renders and then is changed because of the ima开发者_运维问答ge. How can I go about centering this box after it loads the image?


Have you tried to set the position once the image is fully loaded ?

$( ".selector" ).dialog( "option", "position", 'center' );


What you should do is load the image first then once the image is loaded open the dialog use the load event to determine when to when to open the dialog


I think the real issue here is that the dialog box is position:fixed. Depending on the dialog boxes margin sizes you might not have enough real estate to display the full image in the dialog box.

Still this is only speculation. Can you provide an example, maybe on http://jsfiddle.net/ if you can't show the actual site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜