Jquery UI对话框无法定位

时间:2017-05-20 03:03:27

标签: javascript jquery css

所以我在jquery ui网站和其他类似的stackoverflow问题上查了一下我刚刚被困/混淆了。我的对话框只是默认为中心,无论我放入什么,每当我输入代码,其他人似乎已经在这里修复它我的停止工作。

我的HTML:

<div id = "dialog-3"
     title = "How is this data aquired?">Any crime publically reported by a local police department is gathered and shown on the map!</div>

我的JS:

$( "#dialog-3" ).dialog({
           autoOpen: true, 
           hide: "explode",
           height: 80
        });
$("#dialog-3").dialog(option, position) [25,25];
     });

提前感谢您对编码非常陌生,如果这是一个愚蠢的修复,请对不起。

1 个答案:

答案 0 :(得分:1)

根据Eclipse Collections

  

默认:{my:&#34; center&#34;,at:&#34; center&#34;,of:window}

您实际上并未设置位置,因此它显示默认行为。要解决此问题,请在getter或setter中设置相对于传统定位元素的位置

$( "#dialog-3" ).dialog({
       autoOpen: true, 
       hide: "explode",
       height: 80,
       position: {
         my: "left top",
         at: "left+25 bottom+25",
         of: "#positioned-div"
       }
});

$("#dialog-3").dialog("option", "position");

-OR -

$( "#dialog-3" ).dialog({
       autoOpen: true, 
       hide: "explode",
       height: 80
});

$("#dialog-3").dialog("option", "position", {
         my: "left top",
         at: "left+25 bottom+25",
         of: "#positioned-div"
});

祝你好运,编码愉快!

相关问题