是否可以指定 jQuery UI 位置,其中 X 坐标相对于 element1,Y 坐标相对于 element2?
示例 1:我想弹出一个对话框,使其水平居中,但垂直居中于其他元素。
示例 2:我的 DOM 中有两个项目,我想将第三个放置在这两个项目的外角。我知道我可以选择他们每个人的位置,并使用一个中的 x 和另一个中的 y,但是这样做看起来会更好
jQuery('#UpperRight').postion({
my : 'right top',
at : 'right',
of : '#rightMostItem',
at : 'top',
of : '#topMostItem'
}) // double parameters don't work of course
或者
jQuery('#UpperRight').position({
my : 'right IGNORE',
at : 'right IGNORE',
of : '#rightMostItem'})
.postion({
my : 'IGNORE top',
at : 'IGNORE top',
of : '#topMostItem'
}); // where IGNORE overrides the default center
到目前为止,所有尝试都以“中心”为默认设置,不允许使用“我在一个方向上的当前位置”作为基础。任何好的想法都非常受欢迎!