0

同じページで 2 つの jQuery オブジェクトを使用しようとしていますが、両方を同時に動作させることができないようです。私はこのことにかなり慣れていないので、これについてあなたの助けに本当に感謝しています.

head セクションのコードは次のとおりです。

<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js">
</script>


    <script src="jquery.easing.1.3.js" type="text/javascript"></script>  
  <script type="text/javascript">
        $(document).ready(function() { 

            $curtainopen = false;

            $(".rope").click(function(){
                $(this).blur();
                if ($curtainopen == false){ 
                    $(this).stop().animate({top: '0px' }, {queue:false, duration:350, easing:'easeOutBounce'}); 
                    $(".leftcurtain").stop().animate({width:'60px'}, 2000 );
                    $(".rightcurtain").stop().animate({width:'60px'},2000 );
                    $curtainopen = true;
                }else{
                    $(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'}); 
                    $(".leftcurtain").stop().animate({width:'50%'}, 2000 );
                    $(".rightcurtain").stop().animate({width:'51%'}, 2000 );
                    $curtainopen = false;
                }
                return false;
            });

        }); 
    </script>
4

1 に答える 1

1

問題は対立があることだと思う

jQuery は、競合を解決する優れたソリューションを定義しています: jQuery.noConflict。この関数を使用すると、jQuery にアクセスできる独自の名前を定義できます。

var $jq = jQuery.noConflict(true);
于 2012-10-13T15:17:37.820 に答える