【问题标题】:How to adjust the positioning of the custom dialog box using jQuery?如何使用jQuery调整自定义对话框的位置?
【发布时间】:2012-08-16 08:55:27
【问题描述】:

我有一个自定义对话框,现在我需要将自定义对话框定位到所需位置,如何在 .html.erb 文件中执行此操作?

【问题讨论】:

    标签: jquery ruby-on-rails jquery-ui dialog


    【解决方案1】:

    使用小部件 .dialog() jQuery UI 提供了更改对话框位置的选项

    使用起来很简单:$("#selector").dialog({position:"center"}); // center is default value

    或更高版本$("#selector").dialog("option","position","center");

    可能的值:

    • 表示视口内位置的单个字符串:'center'、'left'、'right'、'top'、'bottom'。
    • 一个数组,其中包含一个 x,y 坐标对,以视口左上角的像素偏移为单位(例如 [350,100])
    • 一个包含 x,y 位置字符串值的数组(例如,['right','top'] 表示右上角)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-29
      • 2016-06-25
      • 2014-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-08
      相关资源
      最近更新 更多