开发者

YUI: how to create a fixedcenter dialog that takes all the vertical space available

With YUI, I am creating a fixedcenter dialog, giving it a certain width:

var myDialog = new YAHOO.widget.Dialog("my-dialog", { 
    width : "300px", fixedcenter: true });

The content of the dialog is dynamic, and might be large enough that the height of the dialog becomes larger than the height of the viewport. For instance, see this example (to see/change the source click on the "+" at the top right). Make your browser window smaller before loading this example, and you'll see you can't reach the rest of the content in the dialog.

YUI: how to create a fixedcenter dialog that takes all the vertical space available

Instead of requiring users to scroll down in the main page to see the rest of the content, I'd like the body of the dialog to expend to the height of the viewport, and when this is not enough, I'd like to have a scrollbar inside the body. This is equivalent to having something like .bd { min-height: viewport-height; overflow: scroll }, where viewport-h开发者_如何转开发eight is the height of the viewport, maybe minus what is necessary for the titlebar.

Setting this min-height could be done in JavaScript with code running when the dialog is shown and when the window is resized, but is there a better way to do this?


...but is there a better way to do this?

Nope - not with CSS.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜