Welcome Guest, Not a member yet? Register   Sign In
Lightbox with CI Problem... not working.
#1

[eluser]bibbles10504[/eluser]
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

Code:
<a >Thumb;?&gt;" rel="lightbox"><img >Thumb;?&gt;" src="http://www.doublediamondllc.com/uploaded/portfolio/thumbs/&lt;?php echo $row->Thumb;?&gt;"   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!

(I had to get rid of the opening script tags because they wouldn't post in here... but they are correct in my CI application.
#2

[eluser]kentimus[/eluser]
I use the base_url function to make sure the view is really getting to the javascript file. To use this function, make sure you have the url helper loaded.

Code:
&lt;script type="text/javascript" src="&lt;?=base_url();?&gt;js/prototype.js">&lt;/script>
&lt;script type="text/javascript" src="&lt;?=base_url();?&gt;js/scriptaculous.js?load=effects,builder">&lt;/script>
&lt;script type="text/javascript" src="&lt;?=base_url();?&gt;js/lightbox.js">&lt;/script>
#3

[eluser]bibbles10504[/eluser]
In my CI application I just wrote out the whole URL rather than using the URL helper. When I use firefox to view the source I can click on the links to the js and css files and they all display the proper files. So all the links are linked right... still doesn't work though.
#4

[eluser]kentimus[/eluser]
Is this on a live website? Do you have a url so I can look at your html?
#5

[eluser]bibbles10504[/eluser]
http://www.doublediamondllc.com/index.ph.../WebDesign
#6

[eluser]kentimus[/eluser]
Okay, I think your problem might be that you are using both jquery.js for one thing and prototype.js for lightbox. Often when you try to use jquery and prototype at the same time, your javascript doesn't work.

3 possible suggestions:

1) Put the script tag for your jquery stuff before your script for your prototype/scriptaculous/lightbox. That should fix your lightbox problem. However, it may cause issues for whatever you are doing with jquery.

2) I've never used it, but I found this jquery lightbox plugin: <a href="http://leandrovieira.com/projects/jquery/lightbox/">http://leandrovieira.com/projects/jquery/lightbox/</a>. Using that instead of the lightbox that runs on prototype and scriptaculous might get rid of your javascript conflicts.

3) Read up on how to use jquery with other libraries: <a href="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">http://docs.jquery.com/Using_jQuery_with_Other_Libraries</a>
#7

[eluser]bibbles10504[/eluser]
I moved the script tag for jquery above the prototype tags and it worked
Thanks
#8

[eluser]kentimus[/eluser]
Happy to have been able to help.




Theme © iAndrew 2016 - Forum software by © MyBB