如何设置弹出位置?

时间:2010-03-01 06:47:57

标签: javascript jquery jquery-ui

我在Asp.Net上工作vs08 C#。我想显示弹出窗口**按钮的底部**。不在页面中心。这是我的语法。

Aspx代码:

<input id="Button3" type="button" value="Open 1" />

Jquery的:

<script type="text/javascript">
  $(function() {
      $("#Popup").dialog({
          bgiframe: true,
          autoOpen: false,
          height: 300,
          modal: true,
          buttons: {
              Cancel: function() {
                  $(this).dialog("close");
              }
          },
         close: function() {
              allFields.val("").removeClass("ui-state-error");
         }
      }).parent().appendTo($("form:first"));
      $("#Button3").click() {
        $("#Popup").dialog("open");
      });
    });
</script>

显示语法或修改我的语法。感谢。

2 个答案:

答案 0 :(得分:1)

您需要在options参数中添加position字段:

<script type="text/javascript">
  $(function() {
      $("#Popup").dialog({
          bgiframe: true,
          autoOpen: false,
          height: 300,
          modal: true,
          position: [100, 200], // 100 is x location, 200 is y location, in pixels
          buttons: {
              Cancel: function() {
                  $(this).dialog("close");
              }
          },
         close: function() {
              allFields.val("").removeClass("ui-state-error");
         }
      }).parent().appendTo($("form:first"));
      $("#Button3").click() {
        $("#Popup").dialog("open");
      });
    });
</script>

position也可以接受"top""left"这样的字符串。

有关详细信息,请参阅jQuery UI Dialog documentation

答案 1 :(得分:0)

只需将“关键字”关键字添加到您的查询中,例如

职位:[400,500]

相关问题