Lightbox 2在哪里定位弹出窗口的逻辑是什么? [英] What is the logic of Lightbox 2 on where to position the popup?

查看:168
本文介绍了Lightbox 2在哪里定位弹出窗口的逻辑是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Lightbox 2 在何处放置弹出窗口的逻辑是什么?

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

看来,当使用Firefox或Chrome时,它会显示在不同的页面上的不同位置。是否有任何设置,它在每个页面上显示在相同的高度一致性?

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?

用于确定定位的CSS或逻辑是什么?

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

推荐答案

p>以什么方式显示在不同的地方,你想要的行为是什么,你能给一个样例页吗?

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

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

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();

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

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

这篇关于Lightbox 2在哪里定位弹出窗口的逻辑是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆