PDA

View Full Version : Can I combine two scripts into one?



margrettadevries
07-31-2008, 05:02 PM
1) Script Title: Bullet List Accordion Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-bullet.htm

3) Describe problem: I am trying to use your scripts and menu pattern in a page where I am currently limited to pulling in two scripts. Is it possible to combine ddaccordion.js and jquery-1.2.2.pack.js into one file and still have the scripting work for the menu?

I am also going to try to figure out how to gain permission to use more than two scripts, but if I can combine these, I should be able to fix my issues more quickly.

I really like how this menu looks and works for me, and would be disappointed if I could not use it after all!

Thank you for your assistance!
Margretta de Vries

jscheuer1
07-31-2008, 05:26 PM
I don't see why not, though I may be missing something. Here's what I'd do:

Using a text only editor like NotePad, open up both scripts. Make sure word wrap is off for both files. Now, the jquery-1.2.2.pack.js code would probably need to come before the ddaccordion.js code, so I would add a few blank lines at the end of the jquery-1.2.2.pack.js file, and then copy and paste the entire contents of the ddaccordion.js file to the bottom of the jquery-1.2.2.pack.js file. Save it as - say:

ddaccordion_with_jquery-1.2.2.pack.js

Then you would need just one external script call for it on your page, replace:


<script type="text/javascript" src="jquery-1.2.2.pack.js"></script>

<script type="text/javascript" src="ddaccordion.js">

/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>

with:




<script type="text/javascript" src="ddaccordion_with_jquery-1.2.2.pack.js">

/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>