PDA

View Full Version : Need Help. Js Conflict



hgpedrobg
03-15-2011, 09:23 PM
1) Script Title: JQuery Accordion and Js LightBox
2) Script URL (on DD):
Accordion - http://jqueryui.com/demos/accordion/
LightBox - http://www.huddletogether.com/projects/lightbox2/
3) Describe problem:

To get it done, I just download the sample file that the tuturials usually suply and adapted to my files.

How the code works:

Accordion:
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.10.custom.min.js"></script>

<script type="text/javascript">


$(function(){

// Accordion
$("#accordion").accordion({ header: "h3" });

});

</script>

This piece of code makes a function wich will be called in a <div> later:
<div style="margin:15px 65px" id="accordion">
here is the accordion id.

LightBox:
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>

This piece of code is called later in a <a> tag with an rel="lightbox"
<a href="images/big_trab01.jpg" rel="lightbox"><img src="images/trab01.jpg" width="538" height="295" alt="" /></a>

So the problem is that I can't make then work 2gether. If I delete one code the other work, and vice-versa. Pls tell me what I should do :S

Beverleyh
03-16-2011, 09:48 AM
jQuery is probably conflicting with Prototype so try running it in compatiability mode: http://docs.jquery.com/Using_jQuery_with_Other_Libraries