.animate()-旧jquery Verions(Drupal)冲突的队列模拟

.animate()-旧jquery Verions(Drupal)冲突的队列模拟,jquery,drupal,module,jquery-animate,queue,Jquery,Drupal,Module,Jquery Animate,Queue,我正在寻找jquery版本的解决方案,Drupal本机就包含了这个版本。这是一个旧版本。实际上没有什么问题,但有一个问题:D我使用了一个.animate()函数,该函数带有一个queue false,并且没有这个属性(因为这个属性是在jquery 1.7中添加到.animate()的),它没有按照我想要的那样设置动画 代码是: //When mouse rolls over $("#login").bind('mouseover mouseenter',function(){ $("#logo"

我正在寻找jquery版本的解决方案,Drupal本机就包含了这个版本。这是一个旧版本。实际上没有什么问题,但有一个问题:D我使用了一个.animate()函数,该函数带有一个queue false,并且没有这个属性(因为这个属性是在jquery 1.7中添加到.animate()的),它没有按照我想要的那样设置动画

代码是:

//When mouse rolls over
$("#login").bind('mouseover mouseenter',function(){
$("#logo").stop().delay(500).animate({top:'-44px'},{queue:false, duration:600, easing: 'swing'})

$("#login").stop().animate({top:'89px'},{queue:false, duration:600, easing: 'easeOutBounce'})
});

//When mouse is removed
$("#login").bind('mouseout mouseleave',function(){
$("#logo").stop().animate({top:'6px'},{queue:false, duration:600, easing: 'easeOutBounce'})

$("#login").stop().animate({top:'40px'},{queue:false, duration:600, easing: 'swing'})
});

也许你能帮我找到解决办法?问题是,为什么我要排除我用于此(1.8.3)的jquery版本是因为Drupal模块没有显示wysiwyg(CKEditor),而jquery 1.8.3是额外包含的,不幸的是,我无法用jquery 1.8.3替换核心的jquery版本:(

我总是通过常规的香草js来实现这一点;只要在延迟/超时时触发事件即可。这可以解决队列问题


.红块{
高度:2米;
背景色:红色;
颜色:白色;
边框:2件纯银;
}​
红砖​
$(文档).ready(函数(){
$(“#testFoo”)。单击(函数(){
fireOneAnimateEvent();
});
});
函数animateRedBlock(){
$(“#testBar”).css('width','100px'))
.制作动画({
宽度:($(“#测试条”).width()*3)+“px”
},500,函数(){});
}
变量延迟=(函数(){
var定时器=0;
返回函数(回调,毫秒){
清除超时(计时器);
定时器=设置超时(回调,毫秒);
};
})();
函数fireOneAnimateEvent(){
延迟(函数(){
animateRedBlock();
}, 500);
}​
您看到了吗?它允许您将不同的jQuery版本加载到同一页面中,而不会发生冲突
 <style type="text/css">
 .redBlock{
     height:2em;
     background-color:red;
     color:white;
     border:2px solid silver;
 }​
 </style>
 <input type="button" id="testFoo" value="click me a bunch of times super fast" />
 <div id="testBar" style="width:100px;" class="redBlock"> Red Block </div>​
 <script type="text/javascript">
    $(document).ready(function(){
        $("#testFoo").click(function(){
             fireOneAnimateEvent();
         });
    });
    function animateRedBlock() {
       $("#testBar").css('width', '100px')
            .animate({
                 width: ($("#testBar").width() * 3) + "px"
            }, 500, function () { });
    }
    var delay = (function () {
       var timer = 0;
       return function (callback, ms) {
           clearTimeout(timer);
           timer = setTimeout(callback, ms);
       };
    })();
    function fireOneAnimateEvent() {
       delay(function () {
           animateRedBlock();
       }, 500);
    }​
 </script>