PDA

View Full Version : Resolved ddaccordion won't work with jqModal



knives_out
05-01-2008, 03:26 PM
1) Script Title: ddaccordion

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

3) Describe problem: I have the jqModal plug-in on my website as well. when I put in ddaccordion it stops working and I get this error in firebug.

$ is not a function
.jqm({

ddadmin
05-01-2008, 06:39 PM
DD Accordion relinquishes the "$" function so another JS framework on your same page (if any) can claim and use it as it desires. This is to avoid conflicts with frameworks that also use "$", such as Prototype etc. Now, if jqModal (or any other jQuery script) on the same page don't take into consideration the above set up and dives straight into using "$", you'll have to manually reclaim "$" for jQuery. In other words, you can add the below to the first line within the jqModal script:


$=jQuery.noConflict()

knives_out
05-01-2008, 09:41 PM
perfect!

thank you for your help!

developerholic
05-08-2009, 07:12 AM
Just like the thread starter,

Hello, Im getting the ff error:
$("#ex4a").jqm is not a function

but $=jQuery.noConflict() did not work for me :(

Im using the ff libs:

<script type="text/javascript" src="js/jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="js/jqModal.js"></script>
<script type="text/javascript" src="js/jqDnR.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.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>


Here's my script on the <--head-->


<script type="text/javascript">

$().ready(function() {

$('#ex4a').jqm({

trigger: '#ex4aTrigger',
overlay: 50, /* 0-100 (int) : 0 is off/transparent, 100 is opaque */
overlayClass: 'whiteOverlay'})
.jqDrag('.jqDrag'); /* make dialog draggable, assign handle to title */

// Close Button Highlighting. IE doesn't support :hover. Surprise?
$('input.jqmdX')
.hover(
function(){ $(this).addClass('jqmdXFocus'); },
function(){ $(this).removeClass('jqmdXFocus'); })
.focus(
function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); })
.blur(
function(){ $(this).removeClass('jqmdXFocus'); });

});

//Initialize first demo:
ddaccordion.init({
headerclass: "mypets", //Shared CSS class name of headers group
contentclass: "thepet", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", "openpet"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(expandedindices){ //custom code to run when headers have initalized
//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
//do nothing
}
})
</script>


I tried adding the code $=jQuery.noConflict(); like this:


$=jQuery.noConflict();
(function($) {

$.fn.jqm=function(o){



Thanks :)