views:

318

answers:

1

I am new to all of this so sorry if this is a stupid question.

I had previously created a lightbox affect for my contact form and had it working great. Clicked contact, lightbox popped up with the contact form that kept in a separate html page. The script references were as follows:

<link rel="stylesheet" type="text/css" href="css/lightview.css" />
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/prototype/1.6.1/prototype.js'&gt;&lt;/script&gt;
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js'&gt;&lt;/script&gt;
<script type='text/javascript' src='js/lightview.js'></script>

Then, I went through a tutorial to add a coda-like slider box and got that all working adding the following scripts to the head:

<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery.scrollTo-1.4.2-min.js" type="text/javascript"></script>
<script src="js/jquery.localscroll-1.2.7-min.js" type="text/javascript"></script>
<script src="js/jquery.serialScroll-1.2.2-min.js" type="text/javascript"></script>
<script src="js/coda-slider.js" type="text/javascript" charset="utf-8"></script>

Once I completed that I found that my initial lightbox function stopped working and the link now just sent me to the html page. No lightbox. Here is the full head now:

<title>index</title> 
<link rel="stylesheet" href="css/style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/lightview.css" />
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/prototype/1.6.1/prototype.js'&gt;&lt;/script&gt;
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.2/scriptaculous.js'&gt;&lt;/script&gt;
<script type='text/javascript' src='js/lightview.js'></script>
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery.scrollTo-1.4.2-min.js" type="text/javascript"></script>
<script src="js/jquery.localscroll-1.2.7-min.js" type="text/javascript"></script>
<script src="js/jquery.serialScroll-1.2.2-min.js" type="text/javascript"></script>
<script src="js/coda-slider.js" type="text/javascript" charset="utf-8"></script>

Here is my nav that sent to the light box:

 <a href="index.html">Overview</a> |
 <a href="index.html">Client List</a> |
 <a href="index.html">Reviews</a> |
 <a href="index.html">News</a> |
 <a href='hiddenforms/candidateform.html' class='lightview' title=" :: :: topclose: true, autosize: true">Candidates</a> | 
 <a href='hiddenforms/contactform.html' class='lightview' title=" :: :: topclose: true, autosize: true">Contact</a> | 
 <a href="candidate.html">Share</a>

I hope that helps. Can you have too much javascript on a page? How do I fix this?

+1  A: 

Look in your error console (Firebug, Web Inspector, etc) for errors. If one script is overwriting properties the other script is expecting, it may break something. You also might want to consider at least deploying with all of your scripts concatenated to a single file, to reduce network lag.

Edit: It might also be a conflict between jQuery and Prototype and/or Scriptaculous. jQuery tries to avoid conflicts with other libraries, but only so much of this can be controlled. Ensure jQuery is loaded before the other scripts and add jQuery.noConflict(); to the end.

eyelidlessness
Thanks man...question...when you say to add jQuery.noConflict... to the end, do you mean to the end of the script in the head? Or is that somewhere in the .js file?
bgadoci
To the end of your jQuery .js file.
eyelidlessness
Thank a lot. I appreciate it.
bgadoci
Not real familiar with javascript so not really sure where in the file to put it. The entire thing, for example, ends: ..."px")}})})();
bgadoci
Immediately after that. At the very end.
eyelidlessness
Thanks again. That didn't work but probably bc I don't understand enough. I appreciate all your time.
bgadoci
Can you please look in the error console (Firebug or Web Inspector) and share any errors that appear when you load the page?
eyelidlessness
Yea...I will do today. Thanks.
bgadoci
This is what it says when the code from above is run. Error: element.dispatchEvent is not a functionSource File: http://ajax.googleapis.com/ajax/libs/prototype/1.6.1/prototype.jsLine: 4619
bgadoci
This is one of the first results I got when I googled that error: http://stackoverflow.com/questions/415550/prototype-and-jquery-peaceful-co-existence
eyelidlessness