goto homepage grab RSS 2.0 feed

Lightbox JS - update

Now with captions! I've also fixed a couple of minor issues involving extra-large images falling out of the viewport and a small gap in the overlay in Firefox. Also, it's more keyboard friendly now. Thanks for all the comments and suggestions.

Grab the latest files here: Lightbox JS

Just a teaser, but per many requests for extended functionality, I am working on a complimentary 'photo-gallery' script. It will include forward/back navigation, preloading, and much more. Check back next week.

  1. #1 Tracey

    January 11, 2006 @ 1:03 am

    Thanks for the excellent script. One question, how could I put a link in the attributes? For example, link to another page or action.

  2. #2 Chad Edge

    January 11, 2006 @ 1:36 am

    Tracey, Are you talking about a link below the enlarged image?

    We're working on that right now (a close link as well as a 'print this image' link that will launch a different file w/ printing options attached).

    I'll post when finished.

  3. #3 Andy

    January 11, 2006 @ 1:54 am

    Thanks, you are are Champion, i found this website this morning (Australian time) and it was pefect except that it didn't have captions, i thought to myself, no biggy i will add captions to it… i come back this afternoon and a new feature has been added. THanks heaps, you have saved me alot of time making this same thing for myself!!!

  4. #4 Chad Edge

    January 11, 2006 @ 2:45 am

    Tracey, here's a hack-job I've been working on to get links working:

    http://www.osnap.net/sandbox/sandbox_lightbox.php

    It's got a way to go, and maybe somebody else can clean the bugger up :)

  5. #5 Ben

    January 11, 2006 @ 2:46 am

    Awesome script!
    But I've got one issue—how can I get this work with image maps? My client's website has 'chunk' images that need to have 4 or 5 links coming off each one. Right now, we're just using image maps. We want to use your script, but can't get it to work with them. It's something with the "Rel=" not working on the link.

    Thanks for anyhelp!
    Ben

  6. #6 Andy

    January 11, 2006 @ 2:57 am

    I have a flash nav bar on my site, which doesn't get 'overlaid' with the lightbox, does anymore have any suggestions to to overlay the flash window, i have already tried changing the z-index, no avail. Thanks in advance

  7. #7 Sean Alsobrooks

    January 11, 2006 @ 3:21 am

    Awesome Script! Very nice and clean and functional.

    I have one question, is there a way to position the full size image on the page? Maybe within an exixting ?

    Thanks,

    Sean

  8. #8 Gábor

    January 11, 2006 @ 3:25 am

    Andy: this is beacuse by default Flash is above of all elements. You can read it here (http://joshuaink.com/blog/82/flash-content-and-z-index) how to avoid this.

  9. #9 Alberto Ortiz Flores

    January 11, 2006 @ 4:02 am

    Hi there, nice script!!

    I have been trying to combine the moo.fx Opacity effect ( a superlightweight javascript effects library ) with this script and I can't find the way to make it happen. … any help in this?

    this is my test page: http://dismorfofobico.com/test.html

  10. #10 raz

    January 11, 2006 @ 5:08 am

    Sweet, thanks.

  11. #11 Tonio

    January 11, 2006 @ 5:09 am

    Excellent !

    The bug mentionned here : http://www.huddletogether.com/2006/01/02/lightbox-js/#comment-374
    has been solved by this update.

    Thank you very much :)

  12. #12 Chris

    January 11, 2006 @ 5:20 am

    Very nice script indeed!

    Would it be possible to resize the images before display dynamically based on browser window width? I have many large images (of varying width) and I would like them to appear at about 70% of the browser width (with height set automatically, so as to preserve aspect ratio). I tried doing this with a few changes to the CSS and script, but I didn't get very far.

  13. #13 laboratik

    January 11, 2006 @ 7:23 am

    @Alberto Ortiz Flores:
    check out the onload events! put the onload events of moo.fx in the
    Lightbox.js file( at the bottom) and test from there? Dont know if it will work but this is often a problem with javascripts….

  14. #14 bpixel

    January 11, 2006 @ 9:24 am

    well done !

    just a suggestion : if you add an iframe methode on your script it will allow us to pen a form, or any other page with the same effect ;)

    regards.

  15. #15 Tom

    January 11, 2006 @ 9:56 am

    Safari 1.2.3 (v125.9) displays the image top left so the loading graphic looks a bit funny. Do you think it's possible to add a history marker, so pressing back takes you to the page with the photos, rarther than the page before the photos if you catch my drift.

  16. #16 Ben

    January 11, 2006 @ 10:00 am

    Excellent Script. Thanks for sharing.

  17. #17 Ross Coombes

    January 11, 2006 @ 10:07 am

    Used this script for the first time today, very nice and very quick to implement, good work sir!

    The only initial problem I found was that in IE, drop downs do not get overlaid and as mine was unfortunately in the middle of the page, it looked rather silly. Changing the z-index didn't seem to make any difference so the only resolution I could think of was to hide all select boxes by putting in…

    var objSelects = document.getElementsByTagName('select');
    for(var i=0;i

  18. #18 Ross Coombes

    January 11, 2006 @ 10:16 am

    Clearly this comment board does not like code!

  19. #19 gandoulfe

    January 11, 2006 @ 10:17 am

    Great!!! its a very good script ! thank you very much

    soon oon www.gandoulfe.com

    well done

  20. #20 Kagou

    January 11, 2006 @ 10:31 am

    Is it possible to hack this script for this :
    Zooming is available to all pictures : larger than specified manually and in a particular id (div or class).

    It will be very interresting in a weblog view. No more to resize picture in posts. If there are pictures in posts larger than what i'v specified then this javascript work.

    Thank you for your work :)

  21. #21 Mark

    January 11, 2006 @ 10:47 am

    This is a pretty slick script. It will definitely be handy in my next gallery.

    Anyone know if there's a way to get this script to display an entire article instead of an image? I'm working on a site now where a feature like that would be pretty slick on. Just display the entire contents of the article in a div (even allowing links and images within the article) and have a close button at the top or bottom. That's just my initial thinking. But I'm not sure how to do it.

    Any help would be greatly appreciated.

  22. #22 Maria

    January 11, 2006 @ 10:50 am

    thank you! :)

  23. #23 Anthony Sangiuliano

    January 11, 2006 @ 10:51 am

    Ross Coombes:

    Another way to overlay the form elements that seem to want to pop through the image is to change the "overlay" object in the code to an iframe and add a filter. It does nothing to how it renders in Firefox, but it makes a difference in IE 5.5+

    Here is what I did:

    I changed:
    var objOverlay = document.createElement("div");
    to:
    var objOverlay = document.createElement("iframe");

    and I added:
    objOverlay.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=80)';

    to the code within the lines where objOverlay is defined.

    The main difference is that Firefox still displays the dark image with 80% opacity, while IE uses a white screen with 80% opacity.

    Hope this helps.

  24. #24 tari

    January 11, 2006 @ 11:00 am

    opera 7.54 keeps showing the animated loading gif even after he has loaded the big picture.

  25. #25 jaclimer

    January 11, 2006 @ 11:09 am

    Thanks for sharing this little gem!

  26. #26 Arthos

    January 11, 2006 @ 11:20 am

    This is cool :) But instead of showing a picture i want to show a small webpage popup. Is this possible ?

  27. #27 Johan

    January 11, 2006 @ 11:22 am

    the photo-gallery sounds really great. looking forward to it!

  28. #28 j

    January 11, 2006 @ 11:44 am

    I'd like to use this for a flash presentation or some other content, besides images, is it possible now or is it going to be possible some day?

  29. #29 kevdotbadger

    January 11, 2006 @ 12:11 pm

    I found that you can add links if you put them within the 'title' value.
    eg title="Cannon! Picture by some guy. Visit more here"

    then just style the links in the CSS how you want with #lightboxCaption a and #lightboxCaption a:hover

  30. #30 Phiger

    January 11, 2006 @ 1:26 pm

    I do love this script.. Although it doesn't seem to work opera (7.53)

  31. #31 Dustin Barbour

    January 11, 2006 @ 3:34 pm

    I've implemented this script to rave reviews from my site's visitors. I have links to higher resolution versions of my images as wel las EXIF data in the caption. Future plans are to hook this bit of JavaScript to an AJAX library to allow users to rate these images in the "popup" as well as hook it to some animation effects to fade the whole deal in. Job well done, Lokesh, but this is just the beginning of what's possible for this script.

  32. #32 Adam

    January 11, 2006 @ 3:35 pm

    On your example page, the top half of the caption cuts off (Firefox 1.5)

  33. #33 uli

    January 11, 2006 @ 3:59 pm

    first of all, thanks for this!

    I have a little problem with IE. I've downloaded your files and built a test case … in IE it doesn't show me the "shadow".

    First of all i don`t understand the usage of the blank.gif, can you tell me what is its use? I coudn't find a blank.gif on your server too. Maybe you can give me a tip what i'm doing wrong …

    * html #overlay{
    background-color: #333;/*IE 5 win*/
    back\ground-color: transparent;/*IE 6*/
    background-image: url(blank.gif);/*IE 5 win*/
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="overlay.png", sizingMethod="scale"); /*All IE ?*/
    }

    thanks in advance, uli

  34. #34 Jan

    January 11, 2006 @ 4:00 pm

    it's genious!

  35. #35 Daniel Jordahl

    January 11, 2006 @ 4:38 pm

    Fantastic dude. Fourteen thumbs up.

  36. #36 Johnnie

    January 11, 2006 @ 5:57 pm

    I love the script, unfortunately I can't use it anywhere until it is cross browser.. find the bugs and make it work. Thanks for your hard work.

  37. #37 Brian Larter

    January 11, 2006 @ 6:30 pm

    I am trying to get this to work on my blog. i use wordpress and it just won't take it it seems.

  38. #38 Keith Cirkel

    January 11, 2006 @ 6:55 pm

    This is a very nice script, I love it and I am using it on my blog at current.

    One thing, I dont know alot about javascript; how could I get it to move the lightCaption div ABOVE the image? This is the only thing I really need to make this perfect, thanks.

  39. #39 AsceticMonk

    January 11, 2006 @ 8:06 pm

    Hi Lokesh, it seems the CSS does not validate.

  40. #40 Dot+Pixel

    January 11, 2006 @ 8:24 pm

    Great script!

    Anyway to add a onResize event handler to keept centred in a browser window?

    best of 2006 already!

    thanks,
    Andrew

  41. #41 tim

    January 12, 2006 @ 12:07 am

    you might want to make your zIndex higher, or have them as user settings, as you'd want the overlay to cover all other dynamic html, such as tooltips and popdown menus.

  42. #42 Alberto Ortiz Flores

    January 12, 2006 @ 2:01 am

    @ laboratik:

    Thanks!! I took your advise and separete all the onlode events to a simple function and now the script is working great combined with moo.fx.

    example @ http://dismorfofobico.com/indice.html

  43. #43 Patrick

    January 12, 2006 @ 4:21 am

    I just used this to enhance my Flickr tool "Favourite Photographers": http://m.ac.nz/c/ - neat addition, I think.

  44. #44 tboley

    January 12, 2006 @ 5:56 am

    Impressiv!

    I`m actually working on a gallery plugin for WordPress (http://www.wildbits.de/mygallery/). Under which conditions can I include parts of your script, Lokesh?

  45. #45 Geoff

    January 12, 2006 @ 6:20 am

    Fantastic script.

    I've implemented it in the pictures section of our website: (http://www.amberfield.com.au). Works beautifully and adds substantial value.

    Thank you.

  46. #46 Roan Lavery

    January 12, 2006 @ 7:36 am

    Brilliant Script! I'm completely loving it.

    With regards to the comment about the CSS being invalid: you can place this CSS inside IE conditional comments, which ensures the CSS remains valid while the script still works in IE.

    I've posted a quick and dirty tutorial about it over on my blog:

    CSS Valid Lightbox JS

    Thanks so much again for this script Lokesh!

  47. #47 Gavin Montague

    January 12, 2006 @ 9:32 am

    Excellent script, well done to you Lokesh.

    I've rewritten it a bit and turned it into a GreaseMonkey script for Flickr. I hope it proves useful to someone

    Flickrbox.

  48. #48 Kevin

    January 12, 2006 @ 9:48 am

    Okay, I was able to get around the IE form problem by making my drop-down box invisible when the lightbox is up. I did this by first putting the box in a div labled "text2"

    then I added this code in the showLightbox function:
    var objForm = document.getElementById('text2');

    This in imgPreload.onload function:
    objForm.style.display = 'none';

    And these two lines in the hideLightbox function:
    objForm = document.getElementById('text2');
    objForm.style.display = 'block';

    this will make whatever is in the "text2" div disappear when the lightbox image is open and show back up when it is closed. This may not have been the most eloquent way to do it, but it works.

  49. #49 Kevin

    January 12, 2006 @ 9:50 am

    BTW Lokesh, I really like the script.

    The next thing I'd like to figure out is how to add navigation links in the maximized image. That way someone could go to the next or previous large picture without closing and clicking on another thumbnail.

  50. #50 Darren

    January 12, 2006 @ 1:21 pm

    Works great just implemented on a dvelopment site http://petslive.websights.co.uk/productDetails.asp?MainCategoryID=4&subCategoryID=8&productID=153

    Anyone had any problems with Safari specifically not closing the enlarged image?

  51. #51 Gerard Gorman

    January 12, 2006 @ 2:50 pm

    Great job, I love this script.

    Thanks, Gerard

  52. #52 Robert van Seggelen

    January 12, 2006 @ 2:58 pm

    Hi!

    I stumbled over your site via styleboost.com and checked out your lightbox script, with is very stylish I must say.
    I have recently made a simple pictureviewer (http://www.robertvs.com/projects/pic_viewer) and am wondering if I can use some of your css for the darker background effect on my project.

    Anyway, cool stuff!

    /robertvs.com

  53. #53 Al Geddis

    January 12, 2006 @ 3:00 pm

    This is a super piece. It works great with generating albums. Thanks is not strong enough.

  54. #54 axel

    January 12, 2006 @ 3:28 pm

    woa i'm stunned. the script is really cool, why didn't anybody do this before? besides: your website is utterly charming :)

  55. #55 António

    January 12, 2006 @ 5:26 pm

    This is a great script, Very useful for portfolios too! Keep improving it, it's getting better every day :-)

  56. #56 António

    January 12, 2006 @ 5:27 pm

    Sorry about another comment, but I forgot to say:

    Please keep Opera Browser support in mind! :-)
    Thanks.

  57. #57 Prashant

    January 12, 2006 @ 6:06 pm

    This script is looking great!

    Keep up the good work :)

  58. #58 Barry

    January 12, 2006 @ 6:23 pm

    Anyone having issues on getting this to work with sitemesh and JSP files?

  59. #59 Lokesh

    January 12, 2006 @ 8:39 pm

    Kagou - There is no way to physically resize the actual image with Javascript. You can only make adjustments with the width and height attributes.

    Antonio - I've tested w/Opera 8.0 successfully.

    bpixel, Mark, Arthos, j - I'm working on it!

    Anthony Sangiuliano - Neat idea to use an iframe instead of a div to circumvent the form elements showing through the image in IE. The other solution as others have mentioned is to set the visibility to hidden for problem form elements.

    uli - If the shadow is not showing up, make sure the overlay.png is in the right spot.

    Roan Lavery - Nice work with the valid CSS.

    Gavin Montague - I love it! Flickrbox

  60. #60 eric

    January 12, 2006 @ 9:13 pm

    any way this could work with an image map?

    regardless, it kicks butt.

  61. #61 Adam

    January 12, 2006 @ 10:37 pm

    Ah, I think the problem with the cut-off captions on your example page in firefox is because the image pushes itself down on the apge if it is too near the top and then goes over some of the text… when I'm scrolled all the way up it overrides some of the image text, when I scroll even the slightest bit down, I can see the captions great. I can get screenshots if you don't see it.

  62. #62 jack

    January 13, 2006 @ 4:46 am

    nice..i remember seeing this in most flash site
    anyway to do this in actionscript?

  63. #63 Xavez

    January 13, 2006 @ 5:06 am

    Deliscious mate! Been looking for a neat gallery for a long time now and since I just don't have the knowledge to start coding everything from scratch… -> bookmarked! ;)

  64. #64 Harmony

    January 13, 2006 @ 6:16 am

    Brilliant script! Beautifully presented, coded and very simple to implement, thank you so much :)!

  65. #65 Brendan

    January 13, 2006 @ 7:36 am

    Very nice work Lokesh.

    Have you seen the javascript zoom-in photo viewer at Cabel Sasser's weblog?

  66. #66 bradleyD

    January 13, 2006 @ 10:03 am

    This brings a tear to my eye its so lovely!

    Thanks for the hard work and free offering!

    Cheers.

  67. #67 Lsv

    January 13, 2006 @ 1:27 pm

    Fantastic! You should be working for a large company making amazing additions to their website. (If you aren't already). I'm now using this on my website.

  68. #68 Lance Ball

    January 13, 2006 @ 1:40 pm

    Hi

    I've added textfilter support for this to the typo blogging software. Have a look at this post for more info.

    Thanks much! This is very nice.

    Lance

  69. #69 Guðni Þór

    January 13, 2006 @ 2:32 pm

    I have nothing to say but what a great idea and the implementation is brilljant!

  70. #70 James

    January 13, 2006 @ 5:11 pm

    For some reason, the image wouldn't load over my flash header, meaning, the swf file was on top of the image, which was on top of the page like usual. What do I do to fix that? I'm sure it's my bad.

    This is so awesome, btw!

  71. #71 metheus

    January 13, 2006 @ 5:12 pm

    Very nice script. I think it's interesting how it seems to spark the imagination, it's tempting to ask about "feature X." I will refrain though, posting it as you have is more than generous. I look forward to seeing where things go from here, thanks.

  72. #72 James #2

    January 14, 2006 @ 1:54 am

    Brilliant script, I love it I is verry impressed, but… I'm trying to implament it on one of my web sites. And it works perfectly… in Opera 8.01 only. In every other browser I have tried it in it just opens the image in a new page, i.e. the script isn't used and the image opens like it does by default if you link to another image.

    I'm trying to get it working on this site: http://www.photography.xvi32.net/gallery.htm

    Note if you check it in IE the PNGs don't work… yet.

    The strange thing is that everyone elses implamentation of Lightbox JS works in all browsers. Why am I special? I don't want to be special, I want to be normal like everyone else.

    I'd love to get this script working proprly as it's the best thing I have found in a long time.

    Cheers

  73. #73 Wilfred

    January 14, 2006 @ 6:25 am

    Brilliant script!, saw in on digg a few days back, and now it's on my blog….

    Can't wait for new features!!

    Thanks for the great script!!

  74. #74 Raf

    January 14, 2006 @ 12:33 pm

    Hi, I found your brilliant script on digg a few days ago and worked on implementing it on my new website.

    Just one thing I was wondering about is the possibility to make the enlarged image resize to fit the viewers screen automaticly.

    could this feature be added easely by myself? or is it something you might add in next versions?

    All help welcome :)
    And thanks again for the great script!

  75. #75 John

    January 14, 2006 @ 3:07 pm

    Great script! I made one minor change you might be interested in… I wanted the code to work differently for people who can't use it. I have a gallery and if people dont have javascript, I want to send people to a differnet URL that creates an HTML page, rather than display the jpg image directly (as required by your code). What I did was add another attribute to the line called "LIMG" (for Lightbox Image)… and I kept the HREF the way it use to be.

    In your javascript, I added:

    anchor.setAttribute("href",anchor.getAttribute("limg"));

    Inside the loop at the top of "initLightbox"… basically, if your code excutes, it copies "limg" over "href"…. if your code does not execute, the browser ignores limg and loads the default href. Seems to work great so far!

  76. #76 alex

    January 14, 2006 @ 4:08 pm

    it's brilliant. thanks!

  77. #77 Frode

    January 14, 2006 @ 5:59 pm

    Excellent script! Eight tentacles up :) Thank you for sharing.

  78. #78 takkyun

    January 14, 2006 @ 8:52 pm

    Thank you for your nice and cool script.

    I've also created similar script based on Lightbox JS.

    http://serennz.cool.ne.jp/sb/sp/lightbox/

  79. #79 QRcom

    January 14, 2006 @ 9:55 pm

    Love this script! Kudos!

    I do have one minor problem. I use iframes and would like image to be viewablein the parent frame, not the iframe itself. Can this be done?

    Thanks in advance!

  80. #80 Aaron

    January 14, 2006 @ 11:19 pm

    WOW. good stuff..thanks

  81. #81 John

    January 14, 2006 @ 11:44 pm

    Excellent script! Very glad I came across it.

    I seem to be having the same problem with iframes, however.

    I have a site that has images in an iframe within another page. The lightbox will draw in the iframe, and not on the containing page. Is there a workaround for this?

  82. #82 Dale

    January 15, 2006 @ 3:30 am

    Again, I too am having difficulty with Wordpress- it won't print the javascript onclick functions…

    Is there a way to manually enter them?

  83. #83 X-celent job

    January 15, 2006 @ 6:26 am

    Cool

  84. #84 Tim

    January 15, 2006 @ 9:14 am

    Hey there!
    Thx for releasing this nice script. It seeams to me there is still a little bug. If you have no loadingImage this here will not work:
    Img: objLoadingImage has no properties
    line: 193

    I just did a little 'if' and it worked again!

    Cheers!

  85. #85 Mark

    January 15, 2006 @ 9:40 am

    Lokesh

    Just wanted to say thanks for a cracking script - looking forward to the gallery additions!

    Thanks also to Chris of Alien in London for the pointers of where to have each of the files for a Wordress installation.

    The script really does make a difference to a blog dedicated to imagery hosted elsewhere as it stops users disappearing to other sites.

    Thanks again!

  86. #86 manuel

    January 15, 2006 @ 10:00 am

    first off: thanks a lot LOKESH, it looks perfect- but you know that!

    besides the lightbox.js i have to load another .js which handles full crossbrowser png transparency for img and css-background images.

    maybe you can spot on first sight why those two .js's interfer with each other, but i cant.

    http://beachlevel/wp-content/themes/beachlevel/js/lightbox.js
    http://beachlevel/wp-content/themes/beachlevel/js/pngiefix.js

    maybe you could incorporate the one into the other, because lightbox needs the png alphaimageloader fix anyways…

    would be glad to hear from you :)

  87. #87 manuel

    January 15, 2006 @ 10:02 am

    oops, forgot the .com :D

    http://beachlevel.com/wp-content/themes/beachlevel/js/lightbox.js
    http://beachlevel.com/wp-content/themes/beachlevel/js/pngiefix.js

  88. #88 Andreas

    January 15, 2006 @ 10:53 am

    Hi,
    thanks for the really great script :-) I did some "proof of concept"-Next/Previous Navigation. You can see it at http://www.cronossphere.de/playground/lightbox/

    bye bye

  89. #89 Anonymous

    January 15, 2006 @ 11:26 am

    Andreas, FYI: sorry, but i dont see any nvigation at all using latest safari

  90. #90 manuel

    January 15, 2006 @ 11:27 am

    ^^ me

  91. #91 enzbang

    January 15, 2006 @ 5:49 pm

    Hello,

    I have worked on your script to build a slideshow. I read an XML file to get captions and to build previous and next link.

    You might find some interest in this script :

    http://olivier.ramonat.free.fr/slidebox/

  92. #92 Peter Ketteridge

    January 15, 2006 @ 7:02 pm

    Hi Lokesh

    This is a great little script thankyou for making it available for free it really is quite commendable! One small prolem is we cant seemto change the colour of the caption through the stylesheet (well I cant anyways). I can change it by putting a tag in the caption but I thikn you should really be able to do it via the stylesheet or am I missing something?

    I like my large images to have a black border with a ligh grey text :-)

    Thanks again

    Peter

  93. #93 John Davis

    January 15, 2006 @ 7:23 pm

    This script is great. Just downloaded the new update from 1/15. There is still an issue with small gap in the overlay in Firefox with the large images. I can't fix it! Also, the pictures don't align the same. Some align at the top of page, some align with the middle of the page, some the bottom. The overlay problem could be resolved if all the large images aligned at the top of the page. All in all, this is the best picture script out there. Thank you for offering it.

  94. #94 John

    January 15, 2006 @ 8:39 pm

    Sorry, I meant to say the error still exist in IE, not FF.

  95. #95 Fareme

    January 15, 2006 @ 9:02 pm

    Hey, awesome lightbox script! My fiance and I are both getting ready to implement it on http://lotus.colodojo.com/ff and http://www.w0lfden.com
    it rocks! So neat and stylish, too. keep up the great work.

  96. #96 Andreas

    January 15, 2006 @ 10:47 pm

    @ #89 Anonymous

    first: thanks for the feedback :) and sorry - this was only a short proof of concept - I tested it in IE6 and FF 1.5 on my Windows machine. I have no Mac yet - so I just cant test it on Safarie. Have you gone left and right beside the Image with the mouse? There should apear some "arrows" to indicate the navigation…

  97. #97 Vince

    January 16, 2006 @ 12:50 am

    When a picture is clicked on my website the "loading.gif" comes up but the bigger picture never loads….anyone know what the problem may be?

  98. #98 anith

    January 16, 2006 @ 1:34 am

    Gud one, planning to implement it in my homepage (http://www.anith.com).

    cheers,

    Anith

  99. #99 James #2

    January 16, 2006 @ 4:08 am

    I found out what was making the script work in IE & FF on my web site. It was the image swapping code that was causing lightbox to stop working. If I remove the code then it works, you can see it working here without the code and with out the puddy rollover effect:

    http://www.photography.xvi32.net/gallery.html

    But as soon as i put the code in to get the image swapping working for the menu the script decides not to work. You can see the rollovers in the menu work but not lightbox here:

    http://www.photography.xvi32.net/gallery2.html

    So my question is how do I get both the image rollovers and lightbox to play nice together?

  100. #100 James #2

    January 16, 2006 @ 4:13 am

    P.S. It works perfectly in Opera 8.01, but I spose thats because Opera is a real web browser ;)

  101. #101 takkyun

    January 16, 2006 @ 4:55 am

    Hi, James (#99 and #100)

    >So my question is how do I get both the image rollovers and lightbox to play nice together?

    My script works in your case.

    http://serennz.cool.ne.jp/sb/sp/lightbox/

    When you use Lightbox JS, you can add following code at the end of lightbox.js.

    ==== additional code from here ====
    addLoadEvent(function() { MM_preloadImages('/images/menu01.1home.png','/images/menu02.1gallery.png','/images/menu03.1about.png') } );
    ==== end of additional code ====

    And also it is not necessary to set onload handler at your tag.

    Regards,
    Takkyun

    — here from original code —
    — end of original code —

  102. #102 James #2

    January 16, 2006 @ 5:29 am

    Chhers Takkyun! It works great (it's nearly perfect!) now, thanks so much.

    One thing, it's no biggie just something that I noticed, I'm not sure if it's a bug or not because it happens in every browser I have stested it in (Opera, IE, FF). When the loading.gif is loaded it's always displayed (sometimes streched out of shape) on the far right in the middle of the screen. Whats the cause of this, and how can it be fixed?

    Cheers,
    James

  103. #103 takkyun

    January 16, 2006 @ 6:07 am

    Hi James,

    >on the far right in the middle of the screen

    I've checked it.

    Your style.css (text-align at #Content) causes it.
    You can fix because of chaging your lightbox.css as follows.

    #overlay {
    text-align: left;
    background-image: url(overlay.png);
    }

    yes, just add "text-align: left;" for #overlay.

    Regards,
    takkyun

  104. #104 HellsBells

    January 16, 2006 @ 8:00 am

    Hi - lovely script.

    Only problem I'm having is that if you're not using a mouse, once you've got to the big image you need to tab through all the links on the page to get back to the big image before pressing Enter and returning to the main page.

    Also, once back on the main page I can't seem to "go anywhere" using the tab button without first clicking the mouse on the page. Is there a way to get round this?

  105. #105 James #2

    January 16, 2006 @ 8:04 am

    Thanks Takkyun, thanks for your help and support it's really appreciated.

    I still cant get over how xool the script is, I absolutly love it. You and Lokesh should be verry happy and pround your scripts it seems are a huge sucsess and well done because they are great scripts and deserve to be sucsessfull :)

  106. #106 Pablo

    January 16, 2006 @ 9:34 am

    There are a issue in the overlay that happens in most browsers. Is not the big thing but I can't get fixed:
    1.) Restore the Windows where you are looking Lighbox and open a picture clicking in it.
    2.) Maximixe the window and take a look at the botton of page: you see that te overlat.png has not grown till the end of page…
    Are there some technique to fix this?
    Anyway is a great script… thx!

  107. #107 Pablo

    January 16, 2006 @ 9:37 am

    Sorry … in the comment #116 the secuence is wrong: First open the picture with the browser window maximixed and then restore the window without close the picture so you can see at the bottom the efect mencioned.

  108. #108 Jono | Iconaholic

    January 16, 2006 @ 10:47 am

    Great scipt, thanks a lot!

    I make a mac style rotating circle loading animation to use with it. You can get it here

    http://www.iconaholic.com/images/site-images/loading-mac.gif

    (Made especially for Lightbox JS so won't look good against a light background).

  109. #109 Todd Ross

    January 16, 2006 @ 11:40 am

    If you resize the /browser/ window from larger to smaller, the document recalculates its height (ie, it becomes taller, but narrower). Your Lightbox JS does not accomodate this; the document breaks out from under your overlay.

  110. #110 Chad E

    January 16, 2006 @ 12:45 pm

    This thing Rock's Nice Idea..

  111. #111 Nicola Mattina

    January 16, 2006 @ 1:51 pm

    It would be nice to have a fade-in and fade-out effect when the overlay appears: something very fast, ie 1 second… just to have a transition between tehe page and its "dark version"…
    Ciao from Italy
    Nicola

  112. #112 Jesse

    January 16, 2006 @ 1:53 pm

    You are Big time

  113. #113 mcsnolte

    January 16, 2006 @ 3:32 pm

    Nice work, but is there a setting to keep the image fixed in the center of the screen even though you scroll?

  114. #114 MoeJoe

    January 16, 2006 @ 3:36 pm

    Great Script. is there a way to open the popup when the small images are in an imagemap?

  115. #115 Tristan

    January 16, 2006 @ 6:13 pm

    Nice script, I'm going to use this on our new site! One thing though, the image popus don't center correctly when there is a scrollbar involved, could there be a solution for this problem? Can js know whether there is a scrollbar or not?

  116. #116 Jason

    January 16, 2006 @ 7:32 pm

    This is great, I've used it on my site.

    One thing I noticed is if the target image (the large image) is an animated gif, the image will reappear after closing. The gif frames are still cycling in the background and when it gets back to frame 1, the image pops up again. Either selecting another image real quick or clicking the back button kills it.

    Also, it seems the loading.gif is displayed at a fixed size. Where can I change this if I want to use another loading image? Or better yet, allow the image to be displayed in it's native size, rather than making the script resize it.

  117. #117 Adam

    January 17, 2006 @ 2:23 am

    Found another bug:

    when not using a closing image, the code just doesn't work. I tried specifying a random image and it also didn't work, so maybe it has to be an exact size too? Taking out the code around line ~320:

    // preload and create close button image
    var imgPreloadCloseButton = new Image();

    // if close button image found,
    imgPreloadCloseButton.onload=function(){

    var objCloseButton = document.createElement("img");
    objCloseButton.src = closeButton;
    objCloseButton.setAttribute('id','closeButton');
    objCloseButton.style.position = 'absolute';
    objCloseButton.style.zIndex = '200';
    objCloseButton.style.top = '5px';
    objCloseButton.style.right = '5px';
    objLink.appendChild(objCloseButton);

    return false;
    }

    imgPreloadCloseButton.src = closeButton;

    will get it to work.

  118. #118 Jono | Iconaholic

    January 17, 2006 @ 2:28 am

    Yea, I noticed that Adam.

    I just set a transparent gif as the button & that worked fine.

  119. #119 Berry

    January 17, 2006 @ 5:44 am

    I'm not the first one to tell you: it's brilliant!

    I've been trying this before, but you made it a lot easier. No more popups!

  120. #120 Chestah

    January 17, 2006 @ 6:05 am

    Thankyou! This script is wonderful and integrates nicely into my blog :).

    I appreciate your time and i've bookmarked this site to check back later for updates!

    Any chance you can have a mailing list or "subscribe to this thread" idea.

    Cheers

  121. #121 HellsBells

    January 17, 2006 @ 6:12 am

    I was worrying about the accessibility issues with non-mouse users as I had some difficulty retaining focus on the big image and then once returned to the main page in FF it was impossible to tab anywhere.

    I mentioned this on a forum and a forum member was able to come up with a solution to enable smooth keyboard use too - have a look at the thread to see the solution:

    http://www.csscreator.com/css-forum/sutra79112.html#79112

  122. #122 Bjarte Aune Olsen

    January 17, 2006 @ 6:40 am

    I have made a version of lightbox with next/previous buttons. Take a look:
    http://www.basementmedia.no/blogg.php?id=292

    My trick is to make two javascript-arrays with all the addresses and captions and get lightbox.js to fetch the information from there in addition to have it in the 'href' and 'title' attributes.

    My modified lightbox.js:
    http://www.basementmedia.no/mms/lightbox.js

    I addition to the two arrays (one for image addresses, "ImagesArray", and one for captions, "CaptionsArray"), you need to write the link (a href) code like this:

    a href='http://www.a.com/a03.jpg' rel='lightbox' title='A cool image.' imageNumber='3' imageMax='11'

    imageNumber is the number of the current image you want to open (first image is '0', second is '1'). imageMax is the number of images in the gallery.

  123. #123 Jeremy

    January 17, 2006 @ 10:08 am

    Hi,

    What would need to be changed to use the title attribute o fthe image, not the link, as teh caption?

    I want to use this script but my boss wants the title attribute in the image, not the link. Any suggestions?

  124. #124 Abe

    January 17, 2006 @ 2:50 pm

    Great script!
    I didn't really have a use for it to display pictures, but I was able to tweak it so that I could display editable fields to a user without having then have to go to a new page or open a popup window. It works fantastic with some extra javascript and a dash of AJAX goodness!

  125. #125 Trevor

    January 17, 2006 @ 5:39 pm

    Looks Fantastic

    But I can't get it to work in my simple example ;-( Anyone help?

    Is there more to do than DL the files, throw them into the images folder and then do steps 1 & 2?

    I get no overlay or image. If I include the lightbox.css I get the overlay, but still no image!

  126. #126 eric

    January 17, 2006 @ 9:07 pm

    lightbox is great. got it working on my site (http://www.zealivityfive.com) and i'm loving it. linked you back as well.

  127. #127 Andy

    January 18, 2006 @ 1:09 am

    Great Script!

    But after I upgraded to the latest version (I first installed it on Jan 5th), it doesn't load image(Firefox), or cause JS error(IE). What's wrong?
    my page is
    http://www.matsubarafamily.com/lab/item/87

  128. #128 Andy

    January 18, 2006 @ 9:37 am

    I found a solution.
    around line 196 of lightbox.js, I changed

    objLoadingImage.style.display = 'none';
    to

    if (objLoadingImage) {
    objLoadingImage.style.display = 'none';
    }

    And everything seems to work fine (except that I still cannot find close button)

  129. #129 fob

    January 18, 2006 @ 10:56 am

    Incredible Script! Thank you for sharing!

  130. #130 Paul

    January 19, 2006 @ 2:37 am

    LOVE this script. it's made my photo page for my newborn son 100 times better! Thanks so much, and keep up the great work. I'll be checking back often!

  131. #131 fresh

    January 19, 2006 @ 3:50 am

    this is an awesome script. i'm having problems with it in safari and explorer though. It works great in firefox but in the other two browsers when I click my pic it just opens the linked file.

  132. #132 styke

    January 19, 2006 @ 11:49 am

    this is cool! never knew javascript can do such superb stuff.

    anybody know why it didn't work for my IE 6? it opens the link file in a new blank page.

  133. #133 Nick

    January 19, 2006 @ 12:57 pm

    Hi

    very nice - has a problem if there is already onLoad code in the BODY tag - fails to work

    What does it write to preload images?

  134. #134 Nick

    January 19, 2006 @ 1:08 pm

    I had to include the lightbox.js after the BODY tag, otherwise it didn't detect my existing onload function.

  135. #135 Eric Montz

    January 19, 2006 @ 7:43 pm

    Nice little script you've got here!

  136. #136 Lokesh

    January 20, 2006 @ 12:01 am

    #120 Chestah
    RSS feed!

    #121 HellsBells
    I've just finished adding a keypress action for closing the Lightbox.

  137. #137 Soho

    January 20, 2006 @ 4:39 am

    Lokesh,

    As if you haven't heard it enough… smooth work ;)

    What is needed to display a .swf or .mov in the lightbox overlay space instead of a still image format?

  138. #138 jc

    January 20, 2006 @ 5:29 am

    a very elegant solution to the pop-up window problem/annoyance.

    i changed it to use the rev tag for the caption. that way i could put html in the tag and ff or ie won't display everything in the title/tool tip pop-up

    thanks.

  139. #139 eMPa

    January 20, 2006 @ 6:48 am

    Hi,
    great job!
    But I found a little bug: (browser: firefox 1.5 and IE 6) when you try close image by pressing key other than defined (e.g. space instead 'x') then image is hidden but page still exists in overlay mode. I hope it will be fixed in next release.

    greeting from Poland
    eMPa

  140. #140 Jason Buechler

    January 20, 2006 @ 11:27 am

    TO EVERYONE USING IMAGE-MAPS

    You CAN use them, and it IS an easy fix.

    In the lightbox.js file, find the line:
    var anchors = document.getElementsByTagName("a")
    and change it to
    var anchors = document.getElementsByTagName("area")

    then place "rel=lightbox" in all your area tags for the map
    needless to say, you'll need a seperate .js file if you want to still maintain "normal" functionality

  141. #141 GW

    January 20, 2006 @ 5:31 pm

    #138 JC
    Can you elaborate? I'm rather slow with this stuff. Perhaps an example or a link to your implementation. Your change is just what I need. Thanks in advance.

  142. #142 Resnumerica

    January 21, 2006 @ 2:35 am

    Hi,

    nice script !!!

    I have a question : is it possible insted of that "hit X to close" one can have hit any key to close ?

    Thanks !

    K

  143. #143 ND

    January 21, 2006 @ 11:45 am

    Great Script…..Is anyone else experiencing a problem in IE with the script the 'first' time it is loaded. It never seems to work the first time, but then when I try again in IE, it works perfectly. When I close the window, start again, same thing…..problem only on the first thumbnail I click. After that, smoothe sailing. If someone else has experienced this, please let me know how you fixed it.

    dreamweaver8484 at yahoo dot com

  144. #144 Jason Buechler

    January 21, 2006 @ 12:19 pm

    #143 ND –

    I believe the problem is when you have a page that is not fully loaded. For example, I have several "albums" with 100+ thumbnails that need to load… when I'm not patient, the effect does not happen. When I am — and all elements of the page have loaded, then the script does work. I have no idea why, but I notice this on *every* browser.

  145. #145 ND

    January 21, 2006 @ 4:33 pm

    #144 Jason
    Thanks for the response. What happens is the picture loads the old fashioned way, without the lightbox effect. I have to click the back button to make it work the second time. I don't think it is the page not loading…..thanks anyways.

  146. #146 ND-

    January 21, 2006 @ 4:52 pm

    I don't think you understood my explanation, as the problem you describe is exactly what I too get and why… Try going to any page of thumbnails you have, and instead of clicking on one right away, wait … let's be extreme… wait 3 full minutes. Then try clicking one of your thumbnails. I bet it works the first time.

    J

  147. #147 Jason Buechler

    January 21, 2006 @ 4:52 pm

    oops… #146 was me :-p

  148. #148 ND

    January 21, 2006 @ 11:29 pm

    Thanks Jason….I will give it a try and wait a few more seconds. If you are correct, then it should not be a problem since visitors will read through my site first, giving plenty of load time. Thanks.

  149. #149 MightyDuck

    January 22, 2006 @ 9:52 am

    It doesn't work under Opera. Actually it's not that it never works, it doesn't work every time.
    It is stuck under Opera, the loading gif stays on top, and the real picture is nowhere.
    If I close down the loading gif, (or refresh the page) and click again, the real picture comes in instantly.

    I think the error is in preloading images.(maybe if its in multiple div-s or whatever)
    Does anyone have some advice?

  150. #150 Jono | Iconaholic

    January 22, 2006 @ 12:52 pm

    Works fine in Opera 8.5.1 Mac for me.

  151. #151 ND

    January 22, 2006 @ 2:00 pm

    MightyDuck #149
    I just tested it in Opera, and had the same problem.
    ND

  152. #152 MightyDuck

    January 22, 2006 @ 2:23 pm

    Look at: http://www.fot-online.hu
    It's a hungariaan page. The interesting thing is the at little news's images. They are in multiple div-s, and than in a table.
    And doesn't work. (But work on this page (http://www.huddletogether.com/2006/01/10/lightbox-js)
    But as I see, not I am the only one who had some prblems with it.

  153. #153 Johan

    January 22, 2006 @ 4:01 pm

    The keypress doesn't close the overlay PNG in safari (2.0), only mouse click does that.

  154. #154 Spencer

    January 22, 2006 @ 8:36 pm

    Nicely done sir! A great bit of JS.

    I have only question; Is there a way to stop a vertical page scroll bar appearing when the window is displayed?

  155. #155 Della

    January 22, 2006 @ 11:45 pm

    Elegant is the word! I have begun implementing this lovely script on a site I am currently building. I did get the it to work fairly easily, but when I went to add a Javascript drop down menu in Dreamweaver (*blush), nothing worked… well.. I did get it to work a little, but pretty soon the code was a horrific mess. What can I say? I don't know how to do it yet. ;-p

    I've spent two or three days working on this, and finally have come back here to ask…: Is anyone on this lovely blog willing to show/demo/tell those of us who are code illiterate just how to implement this sweet script along with a simple drop down menu that works off a sliced image? Gosh that would sure be great! I'd also love to add an image rollover script too… haha. Would this be possible?

    thanks Lokesh!

  156. #156 Xavez

    January 23, 2006 @ 4:54 am

    So like, I think I found a "bug"… It doesn't overlay flash! :/

  157. #157 Xavez

    January 23, 2006 @ 4:55 am

    sorry for the commentspam and sorry for the flash-thingy, I was too damned lazy to search this iste for "flash" :D

  158. #158 Eli

    January 23, 2006 @ 2:35 pm

    Whenever I try loading my page in IE, it gives me this error:

    Line:218
    Char:3
    Code:0
    Error:'navigator.PRXappVersion' is null or not an object

    I try everyone else's script and their implementation seems to work fine. Anyone experienced this error?

  159. #159 Glen McHale

    January 23, 2006 @ 8:42 pm

    Lokesh

    Love the script it has given my site a better look and feel, but I have problem with I.E.

    My site works fine within firefox but not I.E., the page with the image on it has the image in a nested table and this works fine in firefox producing the desired effect, but in i.e. all it does is just link to the image it doesnt even put the image as an overlay, i know its a long shot without seeing the html but can you think of any reason for this or a way round it.

    Regards

    Glen

  160. #160 subandono

    January 23, 2006 @ 11:35 pm

    can you tell me, how add google adsense code below the enlarged image?

    thanks, :)

  161. #161 dimitri

    January 24, 2006 @ 8:18 pm

    Thanks for lightbox!
    It really is a great tool and can improve the usability of your website a lot. I use it on my website which is mainly about the Python programming language. See how I use it here:
    http://www.serpia.org/spe
    please add a comment if you like!
    thanks,
    Dimitri

  162. #162 Andy

    January 25, 2006 @ 5:05 am

    Love the new close button feature, what i would like to do with this script is to be able to change it from displaying an img to displaying an iframe where i can put a flash animation or a page of html whatever. But to still also do the image thing too, i expect to have to add in extra attributes and the like.

    My skills in javascript are really up to speed, i have tried changing…

    var objImage = document.createElement("img");

    –to–

    var objImage = document.createElement("iframe");

    and adding in extra attributes etc

    i have also tried changing the…

    var objLightbox = document.createElement("div");

    –to–

    var objLightbox = document.createElement("iframe");

    but to no effect.

    Does anyone have any suggestions, or something that can point me in the right direction

    Regards,
    Andy

  163. #163 Erkki

    January 25, 2006 @ 3:14 pm

    Hi,
    Very nice improvements in this version, great work!

    About Opera:
    -Works a treat in 8.01 on Mac OS X.
    -Works a treat in Opera 8.51 on Linux (Ubuntu flavour).
    -Very buggy in Opera 7.54 Windows XP, just displaying the overlay and loading img if present. Works sometimes on single image in a page, but refuses to work on another page with exactly similar markup. Go figure…
    -Works a treat with Opera 8.51 on Windows XP.

    Other browsers:
    - Icab 3.0.0 close with "x" on keyboard doesn't work but all the rest is fine.

    It is definitely a great cross-browser script :-)
    Keep on the good work…

  164. #164 STILFX

    January 25, 2006 @ 3:21 pm

    Regarding IMAGE MAPS and Jason Buechler solution….

    1 problem, there is no rel attribute in the area tag… so instead, use alt="lightbox"

    Here is the process again:

    In the lightbox.js file, find the line:
    var anchors = document.getElementsByTagName(”a”)
    and change it to
    var anchors = document.getElementsByTagName(”area”)

    then, find:
    ("rel") == "lightbox")
    and change it to
    ("alt") == "lightbox")

    This will validate as XHTML

  165. #165 Erkki

    January 25, 2006 @ 3:30 pm

    Forgot to mention that in Icab 3.0.0, the image is not centered in the viewport once launched. Apart from this nothing else to report.

  166. #166 ND

    January 25, 2006 @ 3:54 pm

    Can anyone help?

    I amusing large images with my lightbox script. Does anyone know a way to program this so when you click onto the larger image to return to the thumbnail, it goes 'exactly' where you originally clicked the thumbnail.

    This allows for easier navigation. Any help would be apprecitated.

  167. #167 yoeri

    January 26, 2006 @ 10:03 am

    Hello,

    When turning zlib.output_compression On (htaccess), the script doesn't load the image anymore. Is that possible or am i just freaking here?

  168. #168 Jason Buechler

    January 27, 2006 @ 12:34 am

    #164 STILFX –

    What do you mean exactly, that there is no "rel" in the area tag? You mean there is none in the current HTML spec? I ask because "rel=lightbox" is working fine for me here:
    http://asuaf.org/~homer/cc-tour/country-club-map.html

  169. #169 Klaus

    January 27, 2006 @ 2:31 am

    @yoeri(#167) hmmm … that can´t be, cause on my new gallerysite i use the compression and everything works fine in every browser, except opera 7.x, there is just the loading gif.

  170. #170 STILFX

    January 27, 2006 @ 11:13 am

    @ - #168 Jason Buechler

    There is no attribute rel. However, if you were to simply use alt the xhtml will validate.

  171. #171 STILFX

    January 27, 2006 @ 11:19 am

    ….Just a reminder, Jason and I are discussing the imagemap mod for lightbox. Specifically the misuse of the attribute rel on an area tag.

    Just because it works, don't mean its right. ;-)

  172. #172 STILFX

    January 27, 2006 @ 11:29 am

    Always validate your code Jason.
    http://validator.w3.org/

    /* Wordpress needs an edit button. */

  173. #173 Tiggr

    January 27, 2006 @ 5:24 pm

    Hi!

    Thank you for the great script, I'm using it somewhere on http://www.colorful-sky.de/ (for example here: http://www.colorful-sky.de/side71.html and here: http://www.colorful-sky.de/workshop/index.php?idcatside=79, sorry folks, only on the german pages…).

    The only problem is, in IE there is allways a border without overlay on the right side of the window. I believe, it's because the padding set to the body tag by css!

    Bye
    Tiggr

  174. #174 Brennan Boblett

    January 28, 2006 @ 1:28 am

    To all you CSS junkies ;)

    position:fixed; seems to work fine in every browser but IE. Was hoping someone could shed some light on this for me and suggest a good, and relatively easy fix. I have seen the jerky scroll java thing, def don't want to go there, not a good solution. Any other good workarounds?

  175. #175 Ryan

    January 28, 2006 @ 5:59 am

    Very sweet script. I want to use it on my site and I can't get it to work. What could I be doing wrong?

    When I click on the image it just opens the file in a new window.

    Thanks,
    Ryan

    http://www.glorydayssportspub.com/glory_new/photos2.html

  176. #176 Stanza

    January 28, 2006 @ 11:55 pm

    Ryan you have quite a mess of styles in the head section of your page, try merging all of your CSS into one file.

    This is a really cool script THANKS Lokesh

  177. #177 Stefan

    January 29, 2006 @ 12:17 pm

    i have an other problem when using lightbox js in IE. loading everythink works fine but when clicking inside of the picture in order to close it and return to the normal website not the wrong page is loaded (base site instead of subsite) … when clicking outside of the picture everythink works fine

    the problem occurs on http://www.webfeeling.at/neu/content_management/ when clicking on one of the three thumbs (site is still under construction)

  178. #178 Yoeri

    January 29, 2006 @ 12:22 pm

    @Klaus (#169) : http://www.stvv.com/image/tid/44

    Tis one works fine (it's lightbox plus, but tested on lightbox too, same result). But when I activate zlib.compression, the thing keeps loading…no picture is showed.

    tnx in advance, tnx for the great script, our users love it!

  179. #179 Gordon

    January 29, 2006 @ 6:19 pm

    New to this gorgeous little script but had to drop by to congratulate you on a great job. I have a feeling I may use this for more than one project!! Awesome!

  180. #180 Brodie

    January 29, 2006 @ 7:01 pm

    Lightbox JS is great. I have been playing around with it for a few days now. Like others i see, I am not the only one having problems with the iframes(getting the image to open on the main window and not within the frame).

    Does anyone now how to do this? Did somoeone solve this issues and I missed it in the comemnts posted already?

    None the less, still a great tool to have.

    -regards

  181. #181 netasceta

    January 29, 2006 @ 9:02 pm

    About the flash issue (isn't a problem with lightbox, is an old welknown flash/browsers bug) here you can find a solution that works like a charm.

    http://www.sitepoint.com/forums/printthread.php?t=158317

    Basically is adding "transparent" property to your flash and set the z-property as you like.

    WONDERFUL WORK DUDE !!

    You made the designer I'm working with the most happy man in this world… and you helped me to change the image I had of been a programmer without any taste for esthetics.

    Thanks again,

    Marc.

  182. #182 Eli

    January 30, 2006 @ 11:36 pm

    Has anyone been able to extend the dark background on IE? If the page of images causes a scrollbar to appear, and if I scroll down, and click on a picture, the dark background doesn't fill all the way.

  183. #183 ND

    January 31, 2006 @ 9:01 am

    Eli #182
    Yeah, that happens to me as well. The problem was only fixed in FF, but not IE. This seems to happen with the larger images. I am hoping there is a fix for that as well

  184. #184 EmmSii

    February 2, 2006 @ 12:24 pm

    Can you separate the JS and CSS entirely?
    Modifying it is quite a hell, no offence.

    Opera (8.5) isn't fully supported, even in your example page the transparent "shadow" doesn't fully cover the page area (@bottom).

    Under caption and kbd divs (you should use instead) is lots of empty space. What's the deal?

    Could you develop also sucha lite-version, which pops up only the image and assign it an id (#lightImg for example)? The html should contain only the closing anchor surrounding the bigger image (no shadows, captions, texts, close buttons, etc). Code:

    Othewise… great idea!
    Thanks!

  185. #185 EmmSii

    February 2, 2006 @ 12:27 pm

    hmm, censor deleted HTML elements…

    - you should use *paragraph* instead

  186. #186 Andy

    February 3, 2006 @ 2:18 pm

    Great little add on script.

    Took all of 2mins to try it out and apart from putting the images/js in different directories and havinvg to change a few references. very easy to use. And the results are very pleasing. Going to try the lightbox gone wild version later to add navigation wile looking at the large pictures.

    http://galleries.captured4ever.co.uk/Galleries.aspx - drill into demo users albums to get to images.

  187. #187 Johan

    February 7, 2006 @ 10:19 am

    Firefox adds height on the div where caption/keyb/etc is compared to Safari/opera/exploder.. just so you know :)

  188. #188 MightyDuck

    February 8, 2006 @ 5:45 pm

    Lokesh, could you take a look at the Opera bug, that some of us mentioned?

  189. #189 weaver

    February 9, 2006 @ 10:06 am

    First off, excellent script. I am 'looking' for places to use this.

    How hard would it be to add the same click event to the picture border that causes the detail to disappear?

    If I click on the image or the background, the detail pic disappears (as expected). In contrast, if I click on the border of the image, nothing happens. Although small, it is likely that the user may click the picture border and be slightly confused.

    Thanks, this is the only point that I could see that could use improvement.

  190. #190 ND

    February 10, 2006 @ 1:17 pm

    Has anyone been able to extend the dark background on IE? If the page of images causes a scrollbar to appear, and if I scroll down, and click on a picture, the dark background doesn’t fill all the way. It was fixed in FF, but the problem still exists. Does any smart person out there know how to fix it?

  191. #191 Jeff

    February 10, 2006 @ 4:05 pm

    I have a small modification for lightbox.js so you don't have to mess with the IE opacity problem and seems to work cross browser. I found it at http://www.mandarindesign.com/opacityblending.html.

    Instead of the settings for #overlay, substitute:
    #overlay {
    background:#000000;
    width:100%;
    filter:alpha(opacity=90); /* for IE */
    -moz-opacity:.90; /* for FF and Moz */
    opacity:.90; /*CSS2 that works in Safarit */
    }

    I haven't tested Opera, but there is probably a workaround for that too.

  192. #192 NickyD

    February 10, 2006 @ 10:49 pm

    Jeff #191
    Thank you for your post. I tried what you posted, but it did not seem to work for me. Could you explain exactly what you did. I put the script in the css instead of the original, but the problem still existed. I was wondering if I did something wrong. Thanks in advance.

  193. #193 Lokesh

    February 12, 2006 @ 10:31 pm

    #184 EmmSii - I've noted the small space uncovered by the overlay in Opera, thanks for letting me know.

    #188 MightyDuck and others - Relating to the PC Opera 7.54 issue, the problem has to do with the proper event not firing when an image is done loading. I'm sure there are ways around this, but I will let it go as it has been fixed in Opera 8.0+. Just looking forward at the moment. : )

    #191 Jeff - The transparency code you posted is a beat more compact but it doesn't seem to work in Opera 8.0.

  194. #194 Nathan Pitman

    February 13, 2006 @ 12:51 pm

    One quick question, has anyone had any success with adding a image hover state such as an overlaid PNG with copyright symbol. You usually see these on photographers websites to do what can be done to prevent casual image theft.

  195. #195 Pete

    February 16, 2006 @ 5:58 am

    Overlaying a copyright watermark with a hover state wouldn't prevent image theft.
    You'd be better off looking at server side solutions to actually embed the watermark dynamically into the image.
    Easier still, just add the watermark in an image editor before you upload it.

    If the watermark is overlaid in, for example, a div then the image itself isn't altered. A right click, image save or quick look at the source code will still save the unwatermarked image.

  196. #196 tg

    February 17, 2006 @ 1:17 am

    Nathan, for an overlaid copyright symbol:
    Point var closeButton = in the lightbox.js file to your copyright image.
    Edit #closeButton in the lightbox.css to bring it over the image, larger positive values brings it further inside the image area.

    Make sure #lightbox img has no background-color, or is set to transparent, if using a transparent gif or png.

  197. #197 Kjell

    February 17, 2006 @ 10:27 am

    Hi!

    I love your work with this script! And I would love to use it.. I have tried to make a small picture webpage but I can't seem to make the lightbox script work. If you could be so kind to check my site at: http://privat.bluezone.no/kjell.braten/galleri.html and see what I do wrong!?

  198. #198 Klaus

    February 17, 2006 @ 1:09 pm

    @#197:
    hi kjell,

    im quite sure your link to the javascript is wrong.

    your source:

    just try:

    or with an absolute path:

  199. #199 Klaus

    February 17, 2006 @ 1:13 pm

    aarrgh … why cant i just copy and paste?

    sorry kjell,
    what i want to say is: delete the "../" in the path to the javascript, or make it an absolute path. im sure it will work then.

    regards, klaus

  200. #200 Kjell

    February 17, 2006 @ 1:23 pm

    Re: 198,199
    Thanks Klaus!

    I have tried all versions of paths, and still no result! :-(

    I am getting frustrated!

  201. #201 Kjell

    February 17, 2006 @ 2:33 pm

    All the other javascript at my website messed with the Lightboxscript. Finding an other way to show rollover-effect.

    Case closed :-)

  202. #202 Alex

    February 19, 2006 @ 7:07 pm

    Can anyone tell me how to add links to the caption or in the caption area?

  203. #203 Colin

    February 20, 2006 @ 6:24 pm

    I can't seem to get the caption to show up with the border. It only shows as the text over the overlay png, which doesn't look very good because both are dark colored.

    any help would be greatly appreciated
    website
    email

  204. #204 phynias

    February 21, 2006 @ 8:21 pm

    does anyone know if there is a way to have it autopop an image from a link.
    so like if i have a page of images and i want to send someone a link to the page but have it auto pop up the image in the lightbox.
    ie
    http://www.domain.com/index.php?IMG_01.jpg

    or something to that affect.
    so it takes them to the page of images and auto shows them that image large.

  205. #205 Nathan Pitman

    February 22, 2006 @ 7:30 pm

    ***Mouse Hover Copyright Overlay ***

    Ok, this is a client side solution using CSS, so as Pete pointed out, it won't prevent anyone who has a reasonable knowledge of the web and who is desperate to steal an image, instead it's just a casual 'reminder' that an image is copyrighted. Thought I'd link it in in case anyone else has a similar requirement. :)

    URL: http://nathanpitman.com/journal/447/

  206. #206 Lokesh

    February 23, 2006 @ 12:08 am

    #203 Colin - remove the misc. html code that ended up in the top of your css file

    Also, big thanks to all those who addressed and troubleshooted other comment author's issues.

  207. #207 Klaus

    February 24, 2006 @ 2:27 pm

    lokesh, i just want to thank you soo much for this amazing piece of code!

    i use it on my new photo-site and it works great.
    see it in action: http://lellesch.com/

    regards, klaus

  208. #208 Maszo

    February 24, 2006 @ 5:11 pm

    Lokesh, this is a great script; I use it on a new website. Just one suggestion. If CSS is turned of (because someone is surfing with an old browser or with a screen-reader) and JavaScript is turned on, then the loading-image and the "lick-to-close"-text will apear just at the top of the page. Maybe it would be possible to load the loading image via CSS-background?

    Regard
    Mazso

  209. #209 Daniel

    February 26, 2006 @ 6:21 pm

    I've been working on implementing this awesome script on my portfolio that happens to be horizontally scrolling. Ive been successful so far but have this one issue with Firefox 1.0 with the white lightbox not shifting to the right. I defined arrayPageScroll[0] and compensating for this in objLightbox.style.left works for Firefox 1.5, IE, and Opera 8. Any ideas?

    http://www.burnoptics.com/portfolio/
    http://www.burnoptics.com/portfolio/scripts/lightbox.js

  210. #210 MN

    February 27, 2006 @ 9:33 pm

    Your script is great. Can't wait for the gallery script and print this image features.

    I notice sometimes though when you close an image and you return to the page the photos are on, the text on the page is sometimes all jumbled up. What causes this and is there a work around for it. Thanks again.

  211. #211 Scott

    February 27, 2006 @ 10:26 pm

    When viewing in Preview in Frontp[age, it works fine. When uploaded, the image loader and the overlay show when the photo is clicked on, but not the image….. please help!!!!

    You can view it at: www.roverscricketclub.com.au/lightboxfiles/stats.htm

  212. #212 David

    February 28, 2006 @ 3:05 am

    Thank you for a great script. I use rails and I added a helper that reads picasa xml albums and uses your lightbox js to display them.

    You can get it at http://www.hackerdude.com/2006/02/27/parse-picasa-xml-with-rails/

    Thanks again!

  213. #213 Cole Henley

    February 28, 2006 @ 3:34 pm

    Hi Lokesh
    First of all thanks so much for a brilliant utility - c'est magnifique!
    I have been experiencing some problems with positioning of images using lightbox js on a dynamic gallery I have created for a friend. In IE 6 photos sometimes randomly position themselves on the page once opened/clicked on. Is this something anyone else has come across/experienced?
    The url for the site is http://www.ryanmcgoverne.co.uk/
    Thanks again for a fantastic piece of code,

    Cole

  214. #214 Ian

    March 2, 2006 @ 12:52 am

    I am having a problem using the lightbox. I have placed all the images and code for the .css and .js correctly but it seems as though it is not reading the .js file. When you click on the photo it just opens a new window as if you just had a direct link to the picture only. what is the problem or what do i need to switch. i cant figure it out.
    please help
    Thanks

    Ian

  215. #215 tg

    March 2, 2006 @ 11:39 pm

    Check out the post at #91 on Slidebox. I'm using it at
    http://bellsouthpwp.net/s/o/solidgolddancers/
    Works great. Thanks Lokesh and Olivier, it's a great combination. I did paste the Slidebox mod (to the original Lightbox) and the Lightbox update together to get the best of both worlds.

  216. #216 supahfunk

    March 6, 2006 @ 4:38 am

    Hi all, the js is fantastic, but i wouldn't open an image in my lightbox.
    J'd like to open an swf file, how can do that? Is it possible? Anyone has an example of it?
    Thank you all.

  217. #217 Jeff G

    March 6, 2006 @ 6:03 pm

    I have one small problem. Everything is working well. I'm using an imagemap and I've made the changes to the lightbox.js file to facilitate this with no problem as outlined above. Works just fine.

    The only problem I'm having is, using the title tag for the caption, I don't like the caption appearing when I rollover the small image. Is there a way to just have the caption appear just with the larger "popup" images?

    I noticed that enzbang in comment #91 created a javascript to call an external xml file. I altered his js file to allow me to use an imagemap and then created an xml file but it's not working (I just get the larger image on a new page, not as an overlay).

  218. #218 Sean K

    March 7, 2006 @ 8:23 pm

    I've been playing around with this great script, and I really like it, however, I'm not sure it will work with my website because my images are in an iframe and I need the lightbox to open in the parent window.

    I see from the comments above that others are having the same issue, has anyone found a way to workaround the issue?

    Sean

  219. #219 offmeetree

    March 8, 2006 @ 11:06 pm

    top job, what a beautiful way to display full size images. Thank You.

  220. #220 Sean K.

    March 9, 2006 @ 2:43 pm

    For anyone having problems using this script from inside a Iframe, I have found a solution. It may not be the best solution, I'm a relative novice at this stuff, but it seems to work ok.

    Insert the script calls into the header of the PARENT html file.
    In the Iframe HTML, change the href of your link to javascript:Void(0) and add an onclick call to a function function(this). Also create a form with a hidden form field with a value = to what the href of your link originally was.

    In the parent file create 2 functions that does the following.

    Function cloneObject(what) {
    for (i in what) {
    this(i) = What(i);

    }
    }
    rename the function below to the same as the onclink function in your link…
    Function function(obj) {
    var newobj = new cloneObject(obj);
    var iframe = document.getElementById("iframename"); this has to be the name of your iframe.
    var iframedoc = iframe.document;
    var iframeForm = iframedoc.getElementById("formname); this has to be the name of your form.
    var hrefvalue = iframeForm.hiddenfieldname.value; this has to be the name of your hidden field.

    newObj.href = hrefValue
    showLightbox(newobj);
    }

    I had to remove a section of the lightbox.js file that didn't like dealing with a copy of the link rather than the link itself.

    The problem code was this:
    if(objLink.getAttribute('title')){
    objCaption.style.display = 'block';
    //objCaption.style.width = imgPreload.width + 'px';
    objCaption.innerHTML = objLink.getAttribute('title');
    } else {
    objCaption.style.display = 'none';
    }

    Removing it didn't seem to have a negative effect on the script.

    There is probably a more elegant way to approach this, but my skills are not quite up to the task.

    Sean

  221. #221 Lokesh

    March 11, 2006 @ 3:32 pm

    #220 Sean K.- Thanks for addressing the frames issue.

    Also, I've added some basic troubleshooting tips on the main Lightbox page that might help a couple of you:

  222. #222 unknown

    March 13, 2006 @ 10:39 am

    hi hi …
    i want to say that u have a bug.. on that lightshow…
    if u loaded a picture and u close it then if u click on the other page
    while it’s loading u close it and if u click on the pic that is clicked before (the already loaded picture) and if the other loading picture loaded he will replace
    the already loaded picture.
    in other words

    image 100% loaded—>click on image2 0% loaded —> close the image2 0% —> click on image 100% loaded —> image replaced to image2 because image2 loaded 100%.

    i think that’s a bug doesn’t it?

  223. #223 Jesse

    March 16, 2006 @ 11:03 pm

    Would love a copy of the iframe supported JS as well as modded iframe doc. I have read Seans post but have been unable to get it to work due to some details that were left out of his description.

    Thanks

  224. #224 ryan

    March 17, 2006 @ 4:11 am

    Yeah, i've read over the post like 10 times and i've been unable to successfully run it.

  225. #225 zircom

    March 17, 2006 @ 4:48 am

    Hey nice script well done, only problem I have is the loading pic not show, only if you link to a pic that dont exist will only the loading pic display?

    Any ideas

  226. #226 Tammie

    March 17, 2006 @ 10:40 am

    I don't know java script and only work with WYSIWYG

  227. #227 Tammie

    March 17, 2006 @ 10:46 am

    Sorry about that I have been up all night and am punchy. As I was saying I use Dreamwever and only go into the code when necessary. I have not been able to get this lightbox to work. I am a novice at the coding part. Can anyone help me? On a new page, I got the image to pop up in the middle but not gray out the bkg. When I moved the code to an existing page that uses templates, It only opened the image in a new window - the close button was gone and so was the caption.
    Can anyone help?

  228. #228 Iframes vs Lightbox

    March 17, 2006 @ 2:49 pm

    The winner Lightbox. My frustrations with using both led me to ditch iframes in the end for a php/css include function that does the same thing as iframes.

    http://tutorials.alsacreations.com/frames/

    Congrats Lightbox!

  229. #229 kurt

    March 19, 2006 @ 4:43 am

    grea