Support » Plugins » [Plugin: Lightbox 2] Reduce top padding of lightbox (image inside)

Viewing 3 replies - 1 through 3 (of 3 total)
  • You’ve probably figured it out already but in case you haven’t (or for anyone else interested) you need to change the following line in lightbox.js:

    this.lightbox.setStyle({ top: lightboxTop + ‘px’, left: lightboxLeft + ‘px’ }).show();

    to something along the lines of:

    this.lightbox.setStyle({ top: ’10px’, left: lightboxLeft + ‘px’ }).show();

    In this case the top padding will be 10px.

    I’m fairly certain that code is outdated. It should be:

    setTop: function(element,t) {
    element = $(element);
    element.style.top = t + “px”;}

    Where you replace t + “px”; with “10px;”.

    However, the problem with this is if you have a gallery, and you open the lightbox by clicking an image at the bottom of the page, the lightboxed-image will open at exactly 10px; from the top (a fixed position).

    Is there any way to make the lightbox “follow along” as the user scrolls down the page, while reducing the padding?

    Well, you’ve probably also figured it out already, but I’m also posting this for future searchers – I just found this page in a Google search while trying to fix it, and it guided me to the right line at least!
    It might be a bit of a hack, but hard coding a subtraction into the relevant line posted above sorted it out for me. Worked in Firefox and IE8 so far.

    this.lightbox.setStyle({ top: (lightboxTop-50) + ‘px’, left: lightboxLeft + ‘px’ }).show();

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Lightbox 2] Reduce top padding of lightbox (image inside)’ is closed to new replies.