简体   繁体   中英

jQuery / Mootools conflict error

I'm trying to do a basic web page which uses both jQuery and MooTools.

You can see a working example here: http://jsfiddle.net/DddQA/

However, anytime I try to reference MooTools, it borks my page.

Here is my current code that I am having issues with:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> 

        <head>

        <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1rc1.min.js"></script>    
        <script type="text/javascript">
        <!-- remove this line below to make the hyperlink box work correctly -->
        jQuery.noConflict();

        //<![CDATA[ 
        $(window).load(function(){
        $(".affiliate-scheme").click(function(){
             window.location=$(this).find("a").attr("href");
             return false;
        });
        });//]]>
        </script>

        <!-- remove this line below to make the hyperlink box work correctly -->
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>

        </head>

        <body id="affiliate-scheme">

            <div class="affiliate-scheme" style="background:red"> 
                 <h3>Affiliate Scheme</h3> 
                 <ul> 
                    <li><a href="/affiliate-scheme/" title="Promote with our Affiliate Scheme">Promote Us</a></li> 
                 </ul> 
            </div> 

        </body>

    </html>

Many thanks for any help here. Very much appreciated.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM