jquery - iframe位置内的JQuery3对话框
问题描述
我正在尝试在 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)
解决方案
您可以考虑以下几点:
position: { my: 'center', at: 'top', of: window }
请参阅:https ://api.jqueryui.com/position/
该at
部分可以使用水平和垂直元素。
定义目标元素上的哪个位置对齐定位的元素:“水平垂直”对齐。有关可能值的完整详细信息,请参阅
my
选项。百分比偏移量是相对于目标元素的。
在查看my
定义时,它说:
定义要定位的元素上的哪个位置与目标元素对齐:“水平垂直”对齐。单个值,例如
"right"
将被规范化为"right center"
,"top"
将被规范化为"center top"
(遵循 CSS 约定)。可接受的水平值:"left"
,"center"
,"right"
. 可接受的垂直值:"top"
,"center"
,"bottom"
. 示例:"left top"
或"center center"
。每个维度还可以包含偏移量,以像素或百分比为单位,例如"right+10 top-25%"
。百分比偏移量是相对于被定位的元素的。
推荐阅读
- oracle - Apex:如何生成模态页面 URL?
- java - 如何使用带有布尔值的 If 语句并读取用户输入
- c - 在 C 中的 Pending Signal Queue 中打印阻塞的信号
- python-3.x - 保存 StandardScaler() 模型以用于新数据集
- python - 单独使用 cv2 python 创建 GUI
- sql-server - 使用 Union ALL 显示所有表中的所有列,每个表中的列数不同
- sql - 复杂表的SQL递归查询
- ios - 警告:+[MRAVOutputContext sharedAudioPresentationContext]_block_invoke 的 AVF 上下文不可用
- angular - 如何禁用浏览器将charterters转换为unicode
- typo3 - 错字3 如何在左栏中创建带有菜单的子页面