Results 1 to 3 of 3

Thread: Lightbox 2.03a Help - positioning

  1. #1
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Lightbox 2.03a Help - positioning

    1) Script Title: Lightbox 2.03a

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...box2/index.htm

    3) Describe problem: Positioning!

    Apologies if this problem is already somewhere in the forum.
    I'm sure there is a real simple fix to this, but I can't work it out!

    How do you reduce the margin at the top of the lightbox when it appears, so it is closer to the top of the browser window?

    This is a great script, use it loads!

    Thanks for any help

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    At the beginning of the lightbox.css file add the highlighted as shown:

    Code:
    #lightbox{
    	position: absolute;
    	left: 0;
    	width: 100%;
    	z-index: 100;
    	text-align: center;
    	line-height: 0;
    	margin-top: -25px;
    	}
    However, be aware that the distance from the top is determined by the user's window's visible area's height divided by 2 minus the height of the lightbox (varies with image height and description (if any) length) divided by 2. It's centered vertically. If the user's window is too short, adding a negative margin can put portions of the top of the lightbox outside the viewable area. For this reason I would say that -50px is the limit.

    I would even say that living with it 'as is' might be a good idea. -10px or -20px should be fine in most cases. Do you have any really tall images that have trouble fitting on your monitor with the default values? If so, consider resizing them (making them proportionally shorter in an image editing program) rather than moving the lightbox.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2011
    Posts
    51
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default

    Hi all!

    I'm not sure if I'm wrong, but I remember when I was trying something similar to the above and I modified a value (the 10?) within lightbox.js file and the result was what I desired. I think humbly that this is a relative best solution...

    Code:
    // calculate top offset for the lightbox and display 
    		var arrayPageScroll = getPageScroll();
    		var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
    Luys
    Last edited by Luys; 05-29-2011 at 05:07 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •