views:

819

answers:

4

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?

A: 
#lightbox{
position: absolute;
top: 100px !important; /*I foxed it 100px from the top, you could fix it as much pixels as you wish*/
}
jmav
the issue here is that if i have to scroll down on the page, it then shows the box off the screen. what i need is 100px relative to the top of the page now . .
ooo
A: 

Try turning off the animation.

Salman A
+7  A: 

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
Residuum
Nice explanation. +1
Boldewyn
A: 

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.

tahdhaze09