Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在同一页面上运行2个jQuery_Jquery_Html - Fatal编程技术网

在同一页面上运行2个jQuery

在同一页面上运行2个jQuery,jquery,html,Jquery,Html,我试图在同一个页面上使用两个jQuery对象,但是,我似乎无法让它们同时工作,如果我使用代码,我可以让一个或另一个工作,但不能同时工作。我对这件事很陌生,所以非常感谢你在这方面的帮助 标题部分的代码如下所示 <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"> </script> <script src="jquery.easi

我试图在同一个页面上使用两个jQuery对象,但是,我似乎无法让它们同时工作,如果我使用代码,我可以让一个或另一个工作,但不能同时工作。我对这件事很陌生,所以非常感谢你在这方面的帮助

标题部分的代码如下所示

<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>

$(文档).ready(函数(){
$curtainopen=false;
$(“.rope”)。单击(函数(){
$(this.blur();
如果($curtainopen==false){
$(this.stop().animate({top:'0px'},{queue:false,duration:350,easeOutBounce'});
$(“.left窗帘”).stop().animate({width:'60px'},2000);
$(“.Right窗帘”).stop().animate({width:'60px'},2000);
$curtainopen=true;
}否则{
$(this.stop().animate({top:'-40px'},{queue:false,duration:350,easeOutBounce'});
$(“.left窗帘”).stop().animate({width:'50%”,2000);
$(“.Right窗帘”).stop().animate({width:'51%},2000);
$curtainopen=false;
}
返回false;
});
}); 

我认为问题在于存在冲突

jQuery定义了一个很好的解决方案来解决冲突:。通过使用此函数,您可以定义自己的名称,jQuery将在其中被访问

var $jq = jQuery.noConflict(true);

非常感谢您的回答,因为我对这个东西还不熟悉,您能进一步解释一下这个函数将如何在我的代码中使用吗。@JamesLeist非常欢迎您。。。在like中有完整的文档