jQuery UI对话框定位:将顶点调整20px - [英] jQuery UI dialog positioning : adjust position top by 20px -

查看:143
本文介绍了jQuery UI对话框定位:将顶点调整20px - 的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过ajax调用填充的对话框。我想限制对话框 max-height ,并允许它可滚动,如果这个最大高度超过。下面的代码正是我想要的。

I have a dialog that gets filled by an ajax call. I want to limit the max-height of dialog and also allow it to be scroll-able if this max-height is exceeded. The code below does exactly what I want.

我无法从顶部位置移动对话框的顶部。我可以左右移动。因为对话框显示在一个大的可滚动窗口中,所以我不能使用中心。如果我使用firebug,我可以调整顶级属性,但找不到它被设置为零。

The catch is I can not move the top of the dialog from the top position. I can move it left and right. I can't use center either as the dialog is displayed in a large scroll-able window. If I use firebug I can adjust the top property but cannot find where it is being set to zero.

$("#your-dialog-id").dialog({
    open: function(event, ui) {
        $(this).css({'max-height': 500, 'overflow-y': 'auto'});
    },
    autoOpen:false,
    modal: true,
    resizable: false,
    draggable: false,
    width: '690',
    closeOnEscape: true,
    position: 'top'
});

我想调整对话框的y位置,所以它是从窗口顶部20px。任何想法我能做什么?

I want to adjust the dialog's y position so it is 20px from the top of the window. Any idea what I can do?

推荐答案

更改最后一个值解决了问题:

Changing the last value solved the problem:

position: ['center',20] 

http://jsfiddle.net/chrisloughnane/wApSQ/3

这篇关于jQuery UI对话框定位:将顶点调整20px - 的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆