Log in

View Full Version : Script conflict - Featured Content Glider & Accordion Menu



Badgio
01-10-2010, 07:04 PM
1) Script Title: Featured Content Glider (altered see below)
Accordion Menu Script (v 1.7.1)

2) Script URL (on DD):
http://www.dynamicdrive.com/forums/attachment.php?attachmentid=1582&d=1202712075

http://www.dynamicdrive.com/dynamicindex17/ddaccordion.js

3) Describe problem:

I am not a coder which is why I have had to resort to asking for assistance.

I am using the above two great scripts to create a portfolio.

However the accordion menu doesn't work when on the same page as the featured content glider script, all the sub-menus are expanded and wont collapse. The featured content works as long as it is initialised first in the html.

When the accordion menu is isolated is works perfectly, (I have it expand/collapse on mouse over) so I wondered if perhaps if there was a conflict between these 2 scripts?

I did a search and found a similar issue that was posted and resolved, by replacing the content glider script with the amended version contained in this thread.

Resolved - Content Glider and Lighbox Conflict
http://www.dynamicdrive.com/forums/showthread.php?t=29309

Having replaced the content glider script with this revised version, still no go!

Any thoughts or suggestions would be greatly appreciated.

Many thanks,

Kevin

jscheuer1
01-11-2010, 05:30 AM
The two scripts work together fine here. Perhaps you are not using the most recent versions.

Please post a link to the page on your site that contains the problematic code so we can check it out.

Badgio
01-11-2010, 09:40 AM
Many thanks John for your reply.

The link to the demo page is here http://www.make-up.lt/covers/.

For your information, I removed the code:
---------
jQuery.noConflict()
---------
from near the beginning of the featuredcontentglider.js file as per your initial reply.

On doing this the featured content glider script stopped working, so I reinstated the above code for the published page.

You will note that the accordion menu doesn't function as per the INIT settings.

As I mentioned before I am using the amended glider script which changed the $ variable to j$, however I had the same issue when using the stock version dated 07.21.2009.

I can revert to the original/latest version if the $ var is not an issue.

Cheers.

jscheuer1
01-11-2010, 03:31 PM
Since they work together fine, revert to the original scripts to avoid any errors that may have crept in during editing of the main scripts. This part (from your page's source code):


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="../rw_common/themes/multinotheme/css/featuredcontentglider.js">
<script type="text/javascript" src="../rw_common/themes/multinotheme/css/accordion/ddaccordion.js">

/***********************************************
* Accordion Content script AND Featured Content Glider 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>


Should look like so:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="../rw_common/themes/multinotheme/css/featuredcontentglider.js">

/***********************************************
* Featured Content Glider 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>
<script type="text/javascript" src="../rw_common/themes/multinotheme/css/accordion/ddaccordion.js">

/***********************************************
* Accordion Content script AND Featured Content Glider 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>

Part of that is to restore the script credit of Featured Content Glider (required by DD TOS (http://www.dynamicdrive.com/notice.htm)), but the main thing is to close the script tag (red) for featuredcontentglider.js so that the one for ddaccordion.js will be recognized by the browser. The way you have it now, ddaccordion.js is not even being loaded.

There could still be other problems. But as I said in my previous post, the two scripts do work together. So at that point it should just be minor issues relating to each script individually, if anything.

Any problems or questions though, just let me know.

Badgio
01-11-2010, 05:06 PM
I have entered the </script> as per your instructions, and its done the trick!

Thanks, very much...really appreciated.

So just so that I understand, when having multiple scripts loaded in the header it is necessary to call them individually in the their own script tags rather than combine them in one set of tags?



On another matter, re the Featured Content Glider script, is there any reason why a background image could not be set? If not, would I just need to change the code under the .featuredcontentwrapper class in the CSS file to reference an image file?

jscheuer1
01-11-2010, 05:26 PM
On page scripts may be combined, as can two or more external scripts. However, one must do so in such a way that doesn't cause problems for any of the scripts. With an external script tag though, only one src attribute is allowed. So you do need a tag for each external script used.

As for the background image, it will be set for whatever selector you choose to set it for. It is possible that the script itself will override that. If that happens you may use the !important keyword in your style to regain precedence, ex:


.featuredcontentwrapper {
background-image: url(some.gif)!important;
}

As to whether or not that will look good, you would have to try it and see.

Note: If the glide contents have background and match the size of the wrapper, the wrapper's background will be hidden. This will also happen if the glide contents are images, and these images' dimensions match the dimensions of the wrapper.