Lightbox 2 在弹出窗口的位置上的逻辑是什么?

发布于 2024-08-08 00:40:50 字数 235 浏览 15 评论 0原文

Lightbox 2 在弹出窗口的位置上的逻辑是什么?

似乎当使用 Firefox 或 Chrome 时,它​​会显示在不同页面的不同位置。是否有任何设置可以使其在每个页面上显示在相同的高度以保持一致性?

它使用什么 CSS 或逻辑来确定定位?

What is the logic of Lightbox 2 on where to position the popup?

It seems that when using Firefox or Chrome it shows up in different places on different pages. Is there any setting to have it show at the same height on every page for consistency?

What is the CSS or logic it's using to determine positioning?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

﹉夏雨初晴づ 2024-08-15 00:40:50

它以什么方式显示在不同的地方,您想要的行为是什么,您能提供一个示例页面吗?

以下是脚本本身如何计算弹出窗口的顶部位置(lightbox v2.04,zip 下载,js/lightbox.js,第 229ff 行):

// calculate top and left offset for the lightbox 
var arrayPageScroll = document.viewport.getScrollOffsets();
var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
var lightboxLeft = arrayPageScroll[0];
this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();

由于脚本使用 Prototype 的 document.viewport 对象,脚本将弹出窗口定位在当前滚动位置内的 10% 处,如下所示:

------- page start
|
|
|
|
|
------- scroll position top
|
------- start of lightbox popup
|
|
|
|
|
|
|
|
------ scroll position bottom
|
|
|
|
------ page end

In what way does it display on different places, what is your desired behaviour, and can you give a sample page?

Here is how the script itself calculates the top position of the popup (lightbox v2.04, zip download, js/lightbox.js, lines 229ff):

// calculate top and left offset for the lightbox 
var arrayPageScroll = document.viewport.getScrollOffsets();
var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
var lightboxLeft = arrayPageScroll[0];
this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();

As the script uses Prototype's document.viewport object, the script positions the popups at 10% inside the current scroll position, like this:

------- page start
|
|
|
|
|
------- scroll position top
|
------- start of lightbox popup
|
|
|
|
|
|
|
|
------ scroll position bottom
|
|
|
|
------ page end
作死小能手 2024-08-15 00:40:50

我知道这是一个非常古老的线程,但仍然是前 5 名谷歌结果。 IE/FF 给了我很好的结果,但 Chrome 却没有。为了使它们全部一致,

js/lightbox.js 的第 231 行

var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);

更改为“

var lightboxTop = arrayPageScroll[1] + (100);

不完全是所请求的内容,但现在页面是一致的”。

信息取自http://www.lokeshdhakar.com/forums/discussion/5494/fixed-display-position-problems-with-firefox-but-not-ie-on-tall-webpages/p1

I know this is a very old thread, but still top 5 google results. IE/FF gives me good results but Chrome doesn't. To get them all consistent,

line 231 of js/lightbox.js

var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);

was changed to

var lightboxTop = arrayPageScroll[1] + (100);

Not exactly what was requested, but the pages are consistent now.

Info taken from http://www.lokeshdhakar.com/forums/discussion/5494/fixed-display-position-problems-with-firefox-but-not-ie-on-tall-webpages/p1

等数载,海棠开 2024-08-15 00:40:50

lightbox.js 第 231 行中,将除法调整为 10 到 100,如下所示:

document.viewport.getHeight() / 100

示例代码:

    // calculate top and left offset for the lightbox 
    var arrayPageScroll = document.viewport.getScrollOffsets();
    var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 100); // 
    var lightboxLeft = arrayPageScroll[0];
    this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();

In line 231 at lightbox.js adjust division by 10 to 100 like this:

document.viewport.getHeight() / 100

Sample code:

    // calculate top and left offset for the lightbox 
    var arrayPageScroll = document.viewport.getScrollOffsets();
    var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 100); // 
    var lightboxLeft = arrayPageScroll[0];
    this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
仅此而已 2024-08-15 00:40:50

您可以尝试 Flowplayer:

http://flowplayer.org/tools/demos/index.html

您可以通过 CSS 文件将叠加层的位置和大小设置到您想要的任何位置。

You could try Flowplayer:

http://flowplayer.org/tools/demos/index.html

You can set the positioning and size of your overlay through the CSS file to wherever you want.

不可一世的女人 2024-08-15 00:40:50
#lightbox{
position: absolute;
top: 100px !important; /*I foxed it 100px from the top, you could fix it as much pixels as you wish*/
} 
#lightbox{
position: absolute;
top: 100px !important; /*I foxed it 100px from the top, you could fix it as much pixels as you wish*/
} 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文