1

I am using one java script and one jquery in my html file in head tag, but my problem both the scripts are not working, i have used one slide show script and one nav menu script, in this both only one is working , is there any specific order to write these scripts , please find the below script order i have used , i am getting only slideshow. please help me out .

<script type="text/javascript">        google.load("mootools", "1.2.1");</script>
<script type="text/javascript" src="Js/MenuMatic_0.68.3.js" type="text/javascript"
    charset="utf-8">  </script>
<script type="text/javascript">
    window.addEvent('domready', function () {
        var myMenu = new MenuMatic();
    });</script>
<script type="text/javascript" src="Js/jquery.min.js"></script>
<script type="text/javascript" src="Js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="Js/slides.min.jquery.js"></script>
<script type="text/javascript">

    $(function () {
        $('#slides').slides({
            preload: true,
            preloadImage: 'img/loading.gif',
            play: 5000,
            pause: 2500,
            hoverPause: true
        });
    });

</script>
4

1 回答 1

2

看起来您在同一页面上加载了 MooTools 和 jQuery,这将起作用,但您必须替换简写的 jQuery 函数。jQuery 为 jQuery(function) 使用 $(function) 简写,这种简写符号可能会导致问题。

您将需要在 jquery 的任何地方使用 jQuery.noConflict() 函数,并且它的插件使用 $.

http://docs.jquery.com/Using_jQuery_with_Other_Libraries

<script type="text/javascript">

    var $j = jQuery.noConflict();

    $j(function () {
        $j('#slides').slides({
            preload: true,
            preloadImage: 'img/loading.gif',
            play: 5000,
            pause: 2500,
            hoverPause: true
        });
    });

</script>
于 2012-08-23T04:51:15.840 回答