View Full Version : Two javascripts using jQuery?

07-30-2008, 12:09 AM
1) Script Title: Facebox image and content viewer (v 1.1) & Accordion Content script (v1.5.1)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/facebox/index.htm & http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

3) Describe problem: Hello! I am trying to use the Facebox image and content viewer on the same page as the Accordian Content script. Both reference jQuery. Each works fine when the other is taken off the page. I found a thread about jQuery conflicting with Prototype. The solution described was to change all the variables $ to $j. I tried the steps listed in the other thread, but I couldn't get it to work. I am not very familiar with javascript, so sorry if this is an obvious question.

*Note: Sorry, I just read that this type of question is NOT generally supported in this forum.

07-30-2008, 02:35 AM
Actually, if you're using the latest version of Accordion Content script (v1.5+), it will work with other jQuery scripts on the same page without any changes to the "$" function. I just tried adding the two scripts onto a blank page, and both run together without problems.

07-30-2008, 05:32 PM
Thank you so much for your reply. I tried implementing these two scripts on a blank page, like you did, and I eventually got them to work. I don't think facebox liked to work when I moved jQuery out of the facefile directory. I appreciated your help!

09-05-2008, 02:29 PM
If anyone is using the JQuery .js on the same page but are having trouble using an .asp include file...it is an easy solution.

Place the JQuery.js file on the main page that you have your two elements.
(ie. <script type="text/javascript" src="jquery-1.2.2.pack.js"></script> )

Place the .js that is on the main page below this.
(ie. <script type="text/javascript" src="animatedcollapse.js"></script>

For the dynamic content that is on the .asp include page use ONLY the script for the effect you are trying to get.
(ie. <script type="text/javascript" src="ddaccordion.js"></script>

DO NOT re-use the jquery script above on the .asp include file. This will attempt to load the file twice and the first instance of the file will take precedence. It should only be on the page once.