更新时间:2023-12-01 16:36:10
Prototype 已经通过 提供了位置Element.viewportOffset()
.
Prototype already provides positions with Element.viewportOffset()
.
编辑,正如 Mathew 指出的那样document.viewport
给出了其余的信息.例如,
Edit, as Mathew points out document.viewport
gives the rest of the information. For example,
var dialogtop = dialog.viewportOffset().top;
if (dialogtop < 0) {
// above top of screen
}
elseif (dialogtop + dialog.getHeight > document.viewport.getHeight()) {
// below bottom of screen
}