PDA

View Full Version : Lightbox v2.03a js error - not displaying images



tonybabb
01-28-2013, 12:29 PM
1) Script Title: Lightbox image viewer v2.03a

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

3) Describe problem:
Hello, I installed Lightbox v2.03a, I've double checked everything and it looks OK to me. When I launch the page www.artisanbuildersca.com/projects2.php it does not display the image thumbnails (there are three images), although I can mouseover where the thumbnails should be and my cursor changes to indicate a link is there. When I click the link it displays the image in a new tab.
IE9 reports the following JS error :
SCRIPT5007: Unable to set value of the property 'width': object is null or undefined
lightbox.js, line 106 character 6

I'm using Windows 7/ IE9.

I must be doing something wrong but I can't see it. Sorry but javascript is a bit beyond me currently. Thanks for any help

Tony

jscheuer1
01-28-2013, 04:05 PM
There could also be other problems but that version of Lightbox is incompatible with jQuery, so get rid of this:


<script src="js/jquery-1.7.js" type="text/javascript"></script>

It doesn't look as though you're using it anyway. If you are, there are other versions of Lightbox as well as Lightbox like scripts that use jQuery instead of Prototype/Scriptaculous. So if you need jQuery, you would have to use one of those other box scripts. Even if you don't need jQuery, some of those other box scripts that use jQuery are better scripts.

That should fix the larger image opening in another tab. The problem with the thumbnails not showing up is that there are no img tags for them. The Lightbox links are only text links. To have a thumbnail, you need the thumbnail version image of course, and you need to do something like so in the markup:


<a href="images/projects/test/ARTISAN_TRAILER.jpg" rel="lightbox[TEST]"><img src="images/projects/test/ARTISAN_TRAILER_THUMB.jpg" border="0"></a>

tonybabb
01-29-2013, 02:20 PM
John, Thank you so much for the very complete response, I think I'll remove this version of LightBox and browse around DD for a better script that's compatible with jquery. I've used several DD scripts over the years, this is the first one I've had problems with.
Do you have any recommendations for jquery compatible scripts similar to LightBox? Not your job to recommend I know, but....
Thanks again,
Tony Babb

jscheuer1
01-29-2013, 04:35 PM
I don't think DD offers a jQuery Lightbox. For just a basic Lightbox see my blog:

http://www.dynamicdrive.com/forums/entry.php?247-Lightbox-Bad-SlimBox-Good

In it I mention and link to Slimbox 2 and provide an optional init for it that alllows for a linked title. Follow the instructions there. I also mention and include links to Colorbox and Fancybox, which have greater capabilities. There are many more, some just as good if not better (authors often update these scripts). You can Google:

jquery lightbox clones

for more choices. Just be aware that some are not all that great. The last I checked, jQuery Lightbox wasn't all that great, but it may have been updated. One that came upon the scene more recently is EasyBox (http://code.google.com/p/easybox/). It's very good as well.

tonybabb
01-29-2013, 06:32 PM
perfect, thank you very much.
Tony