Results 1 to 4 of 4

Thread: ddaccordion won't work with jqModal

  1. #1
    Join Date
    May 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default ddaccordion won't work with jqModal

    1) Script Title: ddaccordion

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...daccordion.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({
    Last edited by Snookerman; 05-08-2009 at 10:52 AM. Reason: added “Resolved” prefix

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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:

    Code:
    $=jQuery.noConflict()

  3. #3
    Join Date
    May 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    perfect!

    thank you for your help!

  4. #4
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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-->
    Code:
    <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:
    Code:
     $=jQuery.noConflict();
    (function($) {
    
    $.fn.jqm=function(o){
    Thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •