PDA

View Full Version : Lightbox and Accordion Content script conflict



yaronmunz
05-18-2012, 06:51 PM
1) Script Title:
Accordion Content script (v2.0)
Lightbox image viewer 2.03a

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm
http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm
3) Describe problem:
i've implemented "Accordion Content script" wirh jquery 1.6.1
and then implemented "Lightbox image viewer 2.03a"
both work OK when i remove the other scripts.
As i try to implement them together, the accordion stop responding, i.e. the expand/collapse of the sections does not work.

when i load the page, in google Chrome. i get in the developer tools the following errors:
Uncaught RangeError: Invalid array length prototype.js:464
Object.extend.shift prototype.js:464
f.extend.dequeue jquery.min.js:16
f.extend.speed.d.complete jquery.min.js:18
f.fx.step jquery.min.js:18
h jquery.min.js:18
f.fx.custom jquery.min.js:18
f.fx.show jquery.min.js:18
f.fn.extend.animate jquery.min.js:18
f.extend.dequeue jquery.min.js:16
f.fn.extend.queue jquery.min.js:16
e.extend.each jquery.min.js:16
e.fn.e.each jquery.min.js:16
f.fn.extend.queue jquery.min.js:16
f.fn.extend.animate jquery.min.js:18
f.each.f.fn.(anonymous function) jquery.min.js:18
ddaccordion.expandit ddaccordion.js:103
(anonymous function) ddaccordion.js:209
e.extend.each jquery.min.js:16
e.fn.e.each jquery.min.js:16
(anonymous function) ddaccordion.js:194
f.extend._Deferred.e.resolveWith jquery.min.js:16
e.extend.ready jquery.min.js:16
c.addEventListener.z jquery.min.js:16

Pls advs how to solve this problem ...
Best regards,
Yaron

jscheuer1
05-19-2012, 03:16 AM
The two scripts, though they can be made to work together are basically incompatible. Get rid of Lightbox. Use Slimbox2 instead. See:

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

for important details.

yaronmunz
05-19-2012, 09:53 AM
Problem SOLVED !!!!

Updating prototype to version 1.7.0 from google's CDN.
https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js

This solved the conflict between jquery and prototype

jscheuer1
05-19-2012, 04:00 PM
Yes, that will work as long as jQuery is in noConflict mode.

But now you have two script libraries on the page, both of which have about the same capabilities. If you use Slimbox2, you only need one script library on the page - jQuery. Of the two, jQuery is the more robust and it requires far less code to do what Prototype does. So your page(s) will load faster. Also, Slimbox2 has advantages over Lightbox 2.03a.

But, as I said, the two (Lightbox 2.03a and Accordion) can be made to work together.