PDA

View Full Version : Lightbox conflict with another jquery files.



mariana villas boas
08-02-2011, 05:37 PM
hey there.
Im having problem putting lightbox jquery http://www.lokeshdhakar.com/projects/lightbox2/ and liScrow: http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html in the same page.
My LiScrow was working and when I included lightbox script, it stopped to work and lightbox is working fine!
I also tried with slimbox2 and it happen the same thing!
I find out that when I take this script out: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
The LiScrow starts to work again, but than slimbox2 stops to work.
Does any one knows why Im having this problem?
thank you.
Mariana

mariana villas boas
08-02-2011, 06:29 PM
hey there! Just found out it. It was a jquery library conflict!!
thank any way!

twohawks
09-22-2011, 04:40 PM
hey there! Just found out it. It was a jquery library conflict!!
thank any way!

Hi. Would you mind please posting your solution and sources? Thanks.

jscheuer1
09-22-2011, 05:29 PM
They may not have resolved it. If you're using Lightbox 2.05 and only need prototype/scriptaculous for it, I'd recommend changing to Slimbox, see:

http://www.dynamicdrive.com/forums/blog.php?b=247

If you need prototype/scriptaculous for other things. Your jQuery code will need to be put into noConflict mode. How that's done varies. In many cases external jQuery scripts are already noConflict ready. If so all one needs to do is to put the tag for jQuery and the the scripts that use it before prototype/scriptaculous and add:


<script type="text/javascript">
jQuery.noConflict();
</script>

before prototype.

Oh, and if you have an init like:


$(document).ready(function(){
whatever . . .
});

Make it:


jQuery(document).ready(function($){
whatever . . .
});

With certain jQuery scripts there can be other considerations. That and the fact that using Slimbox - if it eliminates the need for prototype/scriptaculous, saves so much on loading time, is why I would recommend converting to Slimbox in most cases.

twohawks
12-01-2011, 02:05 AM
Hey John, ...don't know how this fell through the cracks... just want to say thank you very much for following up with that.
Cheers, TwoHawks