views:

277

answers:

1

I'm trying to use Lightbox with my CodeIgniter application. Lightbox says to put the following in the head tag:

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />

I already had a js folder and a css folder, so I put the js and css folders that came with lightbox within my js and css folder. I changed the 3 script tags and link tags to:

<script type="text/javascript" src="js/js/prototype.js"></script>
<script type="text/javascript" src="js/js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/js/lightbox.js"></script>
<link rel="stylesheet" href="css/css/lightbox.css" type="text/css" media="screen" />

(added the /js and /css)

in the view file I have

<a href="http://www.doublediamondllc.com/uploaded/portfolio/&lt;?php echo $row->Thumb;?>" rel="lightbox"><img name="<?php echo $row->Thumb;?>" src="http://www.doublediamondllc.com/uploaded/portfolio/thumbs/&lt;?php echo $row->Thumb;?>"   alt=""></a> 

This displays the thumbnail version, and then when clicked I want it to go to the lightbox, but now it goes to a new tab with the large image.

I've used lightbox before and have always gotten it to work, I'm not really sure what the problem is now, and I tried moving the files all around to different spots but nothing worked.

Thanks in advance!

+1  A: 

It seems like the .js isn't getting loaded properly. Try using Firebug, and see if any errors pop up. Alternatively, check the links in the source for the page, and make sure they are pointing to the lightbox js files correctly. If you are using Firefox, view source; the links to the js files should appear as clickable links; click on them and make sure the js file appears, and not a 404 or some other error. Otherwise copy and paste the link attributes to your browser and check the .js paths are correct.

stormdrain
all those links work... the only error I am getting is Preferences element.dispatchEvent is not a functionwhich is something in the file that came with the download.
Phil
Are you using jQuery on the same page? If so, you need to set jQuery to `noConflict` otherwise it overwrites prototypes `$` function.
stormdrain
Yep... That was the problem. Thanks!
Phil
No problem. Mind checking the answer as the solution so people know that was it? Thanks!
stormdrain