PDA

View Full Version : Lightbox 2.03a not working



alphadeck
05-09-2011, 04:30 AM
1) Script Title: Lightbox image viewer 2.03a

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

3) Describe problem: Can't get lightbox to work.


I can't get lightbox to work on this page http://joligateau.com/gallery.php

Is it possible there's script conflict? I've done this before but not sure why its not working this time. I've included the code within the head and followed the instructions as per the instructions. I've placed the "rel" link to the images but when I click on the image, it just opens up the larger version in a new window.

I've made sure to upload all the files onto the server and made sure the paths are correct as well. I've even tried moving all files to the root and still doesn't work. I've cleared cache in FF 4.0 and do a hard refresh each time.

I hope its not some stupidity I overlooked I feel real dumb posting but I'm running out of ideas. Thanks for your help.


Al

jscheuer1
05-09-2011, 05:24 AM
Get rid of this:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

alphadeck
05-09-2011, 04:17 PM
That was it!! thanks for the quick reply John... was driving me nuts. appreciate it!!!


AL

Luys
05-16-2011, 10:33 PM
I do not quite understand. That's what I thought at first, but to my surprise neither in the internal code page of DD, nor even that I remember in the original author's page, I found no reference to the use of this basic library. Why?

Luys :confused:

jscheuer1
05-17-2011, 01:54 AM
I do not quite understand. That's what I thought at first, but to my surprise neither in the internal code page of DD, nor even that I remember in the original author's page, I found no reference to the use of this basic library. Why?

Luys :confused:

And that's why removing it fixed the page.

Luys
05-17-2011, 10:51 AM
Hi all!

2John: Apparently, I saw the code above and I assumed that as usual was more an oversight than anything else ... :(
So to have an "unnecessary" reference on a page to the jQuery library it is a hindrance to the execution of other scripts? (This is the case if I use a template for many web pages and some don't need actually the jquery .js file).
Best regards.

2alphadeck: I take a look to the internal source code of your [beautiful] web page with Opera browser and I can see TWO instances of "body onload" tag and TWO scripts that may be the same (one on head, another on body). When I check out this with an old program like Nvu editor, I can see only one perhaps because the application fixed it!
Pay attention, please.

Luys

jscheuer1
05-17-2011, 02:21 PM
Yes. jQuery conflicts with Prototype/Scriptaculous. The two can be made to coexist on the same page, but it can be complicated. If you have both of them on the same page and only need one of them, and there is a conflict, the simplest thing is to remove the one you're not using.

The reason they often conflict is that they both want to define the variable $ in the global scope and then use that as their primary way of identifying and initializing elements. They each define it differently, so only one or the other can win, sometimes they both lose.

jQuery has a way of using noConflict mode. Slightly complex, but usually not too hard to write for as many of the jQuery scripts and plugins are already in noConflict mode or are noConflict mode ready. On that score, if your jQuery script or plugin is like that, you just have to make your initialization code also in noConflict friendly terms. But then the version of Prototype/Scriptaculous used can sometimes - depending upon the script(s) it is used for on the page, be an issue in some browsers. They usually can be updated, which then in turn may create the need to update the version of the script(s) using Prototype/Scriptaculous.

As I say, it can get complicated. It's often better to use just one script library and stick to it. If done well, the user will only have to load it once for the entire site.