Results 1 to 6 of 6

Thread: jquery and mootools swiff conflict

  1. #1
    User
    Join Date
    01-26-10.
    Posts
    37

    Default jquery and mootools swiff conflict

    Hi

    I cannot get rid of the conflict between jQuery and mootools. I use the jquery treeview plugin, and I have a Flash banner for which Contao generates a javascript code using the mootools library. I tried to use the noConflict functionality of Jquery but it doesn' t help. Can soemeone tell me what have I done wrong ?
    Here is the code
    Code:
                            <script type="text/javascript" src="plugins/jquery/jquery-1.4.1.min.js"></script>
    			<script type="text/javascript" src="plugins/mootools/mootools-core.js"></script>
    			<script type="text/javascript" src="plugins/mootools/mootools-more.js"></script>
    			<script language="Javascript" type="text/javascript" src="plugins/jquery-treeview/jquery.treeview.min.js"></script>
    			<script src="plugins/jquery-treeview/jquery.treeview.async.js" type="text/javascript"></script>
    			<link rel="stylesheet" href="plugins/jquery-treeview/jquery.treeview.css" />
    <script language="Javascript" type="text/javascript" >
    $.noConflict();
      jQuery(document).ready(function($){
    		$("#arbo").treeview({
    			url: "plugins/jquery-treeview/treeview.php"
    		});
    	});
    </script>
    
    	</head>
    and within the body, the mootools generated code :
    Code:
    <script type="text/javascript">
    <![CDATA[//><!--
    if (Browser.Plugins.Flash.version > 0) {
      new Swiff("tl_files/peyrichou/flash_header_mini.swf", {
        id: "swf_44",
        width: 360,
        height: 133,
        params : {
          allowFullScreen: true,
          flashvars: "URL=http://contao.dev.acao.fr/"
        },
        container: $('swf_44_container')
      });
    }
    //--><!]]>
    </script>
    The error is " $ is not a function" in the mootools code.
    Thank you for your help.

  2. #2
    User
    Join Date
    06-19-09.
    Location
    Elbl?g, Poland
    Posts
    152

    Default Re: jquery and mootools swiff conflict

    Quote Originally Posted by aida
    The error is " $ is not a function" in the mootools code.
    Thank you for your help.
    Try to use jQuery in noConflict() mode.
    http://api.jquery.com/jQuery.noConflict/
    Marcin

    http://www.contao.pl - Polish Support Site
    http://forum.contao.pl - Polish Contao community forum


    -----------------------
    Need custom template? Feel free to contact me by e-mail marcin@contao.pl

  3. #3
    User
    Join Date
    01-26-10.
    Posts
    37

    Default Re: jquery and mootools swiff conflict

    That's what I did actually (c.f. the jquery code above) but it doesn't work.

  4. #4
    User
    Join Date
    06-19-09.
    Location
    Elbl?g, Poland
    Posts
    152

    Default Re: jquery and mootools swiff conflict

    Quote Originally Posted by aida
    That's what I did actually (c.f. the jquery code above) but it doesn't work.
    Upsss sorry I missed it... but try change this line:

    Code:
    $("#arbo").treeview({
    to this one:
    Code:
    jQuery("#arbo").treeview({
    in noConflict() mode you use "jQuery" word instead $ (dollar sign).
    Marcin

    http://www.contao.pl - Polish Support Site
    http://forum.contao.pl - Polish Contao community forum


    -----------------------
    Need custom template? Feel free to contact me by e-mail marcin@contao.pl

  5. #5
    User
    Join Date
    01-26-10.
    Posts
    37

    Default Re: jquery and mootools swiff conflict

    I removed the noConflict() call, called the jQuery library before the mootools one => the error disappears... so does my Flash banner... :x

  6. #6
    User
    Join Date
    01-26-10.
    Posts
    37

    Default Re: jquery and mootools swiff conflict

    I've done the reverse : called mootools first and put back the noConflict() code .. and it worked at least !
    Thank you Marcin for your help.

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
  •