Results 1 to 5 of 5

Thread: Lightbox II: Modifying "shadow" color

  1. #1
    Join Date
    May 2008
    Location
    SF, CA
    Posts
    4
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Lightbox II: Modifying "shadow" color

    1) Script Title: Lightbox image viewer 2.03a

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

    3) Describe problem: I'm hoping to change the color and/or opacity of the "shadow" that fills the page around the white "lightbox" but I can't figure out where to make such modifications. Can someone get me there? What I'm wanting to try out is making the shadow a solid black.

    Cheers for your time...

    demo page:
    http://arts.ucsc.edu/faculty/watts/pages/noalbum1c.html

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Apparently, it's already black:
    Code:
    #overlay{
    	position: absolute;
    	top: 0;
    	left: 0;
    	z-index: 90;
    	width: 100%;
    	height: 500px;
    	background-color: #000;
    	}
    What makes it pale black, is because of the transparency being applied in effect.js.

    If you really want to make it black, then remove the opacity. Find this in effect.js:
    Code:
    Element.setOpacity = function(element, value){  
      element= $(element);  
      if (value == 1){
        Element.setStyle(element, { opacity: 
          (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 
          0.999999 : null });
        if(/MSIE/.test(navigator.userAgent))  
          Element.setStyle(element, {filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});  
      } else {  
        if(value < 0.00001) value = 0;  
        Element.setStyle(element, {opacity: value});
        if(/MSIE/.test(navigator.userAgent))  
         Element.setStyle(element, 
           { filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
                     'alpha(opacity='+value*100+')' });  
      }   
    }
    Replace the highlighted with '1' and 100 respectively. (Note of the quote)

    Hope it helps.
    Last edited by rangana; 06-09-2008 at 07:26 AM. Reason: Explained more
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. The Following User Says Thank You to rangana For This Useful Post:

    Nyetah (06-11-2008)

  4. #3
    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

    That will probably mess up other things, and/or might not achieve the desired change. It will prevent effects.js from doing any other opacity stuff using that function. However, this line in lightbox.js is where the precise change we are discussing is set in motion:

    Code:
    new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: 0.8 });
    If you change it to:

    Code:
    new Effect.Appear('overlay', { duration: overlayDuration, from: 0.0, to: 0.9999 });
    That will take care of it. Using 0.9999 instead of 1 will prevent a 'flashing' bug in some browsers, and is indistinguishable from 1 to the human eye.
    - John
    ________________________

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

  5. The Following 2 Users Say Thank You to jscheuer1 For This Useful Post:

    Nyetah (06-11-2008),rangana (06-10-2008)

  6. #4
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    That was my bad John. I did'nt quiet test the code.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  7. #5
    Join Date
    May 2008
    Location
    SF, CA
    Posts
    4
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    thanks for your time guys. i appreciate it! i made jscheuer1's suggested change and it works perfectly...Voila! :-) cheers!

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
  •