因此,我在jquery ui网站和其他类似的堆栈溢出问题上进行了查找,我只是卡住了/困惑了。无论我放入什么,我的对话框都默认处于中心位置,而且每当我放入代码时,其他人似乎已经在这里修复了它,我的对话框会停止工作。
我的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];
});提前感谢你,我对编码非常陌生,如果这是一个愚蠢的修复,我很抱歉。
发布于 2017-05-20 11:46:18
根据documentation
默认值:{ my:"center",at:"center",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");-或者-
$( "#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"
});祝你好运,祝你编码愉快!
https://stackoverflow.com/questions/44081509
复制相似问题