【发布时间】:2021-06-15 22:11:47
【问题描述】:
我正在尝试在 iframe 中打开一个对话框。 当我将位置设置为:
position: { my: 'center', at: 'center', of: window }
它指的是 iframe 的窗口。 这需要我在 iframe 很长时滚动。 我尝试使用:
position: {my: "center", at: "center", of: window.top}
但我收到了这个错误:
jquery.min.js:3 Uncaught TypeError: Cannot read property 'defaultView' of undefined
at La (jquery.min.js:3)
at Ma (jquery.min.js:3)
at Function.css (jquery.min.js:3)
at Object.get (jquery.min.js:3)
at Function.css (jquery.min.js:3)
at jquery.min.js:4
at S (jquery.min.js:3)
at jQuery.fn.init.r.fn.<computed> [as outerWidth] (jquery.min.js:4)
at d (jquery-ui.custom.min.js:formatted:614)
at jQuery.fn.init.e.fn.position (jquery-ui.custom.min.js:formatted:666)
【问题讨论】:
-
欢迎来到 Stack Overflow。请查看 api.jqueryui.com/position 类型:选择器或元素或 jQuery 或事件
window.top不是选择器、元素、对象或事件。 -
请提供一个最小的、可重现的例子:stackoverflow.com/help/minimal-reproducible-example
-
感谢您的回答! window.top 我在这里找到:stackoverflow.com/a/15956081
标签: jquery jquery-ui iframe modal-dialog position