Search code examples
jquerymootools

jquery and mootools together not working


I want to add one Mootools slider gallery in my page, but it can not work with other jQuery plugins. how to modify the javascript part? Thanks.

<script type="text/javascript">
var $jq = jQuery.noConflict();
$jq("img").lazyload({ 
    placeholder : "img/logo.png",
    event : "click"
});
</script>
<script language="javascript" type="text/javascript">
window.addEvents({
    'domready': function(){
    /* thumbnails example , div containers */
    new SlideItMoo({
        overallContainer: 'SlideItMoo_outer',
        elementScrolled: 'SlideItMoo_inner',
        thumbsContainer: 'SlideItMoo_items',
        itemsVisible:4,
        elemsSlide:3,
        duration:300,
        itemsSelector: '.SlideItMoo_element',
        itemWidth: 158,
        showControls:1,
        startIndex:5
        });
    }
});
</script>

Solution

  • Modify jQuery's code, let it runs at ondomready event and add noConfilict-ed jQuery to function, which you want run:

    <script type="text/javascript">
    $.noConflict();
    jQuery(document).ready(function($) {
    $("img").lazyload({ 
        placeholder : "img/logo.png",
        event : "click"
    });
    </script>