Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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
多个jQuery效果同时并行_Jquery_Position_Jquery Animate_Parallel Processing_Fade - Fatal编程技术网

多个jQuery效果同时并行

多个jQuery效果同时并行,jquery,position,jquery-animate,parallel-processing,fade,Jquery,Position,Jquery Animate,Parallel Processing,Fade,我想在一个子菜单中同时尝试一下这个位置 就像“下载”上的酷尾码工具提示() 我的代码这次只是淡入淡出: $(document).ready(function(){ $('#access').hover(function () { $(this).children('ul').fadeIn(); $(this).children('ul')...position(); }, function () { $(this).childr

我想在一个子菜单中同时尝试一下这个位置

就像“下载”上的酷尾码工具提示()

我的代码这次只是淡入淡出:

$(document).ready(function(){
    $('#access').hover(function () {
        $(this).children('ul').fadeIn();
         $(this).children('ul')...position();

    }, function () {
        $(this).children('ul').fadeOut('slow');
        $(this).children('ul')...position();
    });
});
谢谢 英戈

现在我这样做:

$(document).ready(function(){
$('#access').hover(function () {
    $(this).children('ul').stop().animate({opacity:1, paddingTop:'10px'}, 400);

}, function () {
    $(this).children('ul').stop().animate({opacity:0, paddingTop:'0px'}, 300);
});
}))


Fadein和填充效果非常好。但不是逐渐消失。我的错误是什么?

只需使用animate()滚动您自己的动画即可。不要忘记先使用
stop
取消当前正在运行的动画

$(this).find('ul').stop().animate({opacity:1, top:'...', left:'...'});

我能想到的最好办法就是利用。它隐式地使用
动画

查看此小提琴示例:

CSS:

.before{
    background-color : red;
    height : 400px;
    width :200px;
    opacity : 1;
}
.after{
    background-color : blue;
    height : 200px;
    width : 400px;
    opacity : 0.5;
}
$(document).ready(function(){
  $('#mydiv').hover(function () {
        $(this).switchClass('before','after',500);
    }, function () {
        $(this).switchClass('after','before',500);
  });
});
jquery:

.before{
    background-color : red;
    height : 400px;
    width :200px;
    opacity : 1;
}
.after{
    background-color : blue;
    height : 200px;
    width : 400px;
    opacity : 0.5;
}
$(document).ready(function(){
  $('#mydiv').hover(function () {
        $(this).switchClass('before','after',500);
    }, function () {
        $(this).switchClass('after','before',500);
  });
});

这个关于并行动画的答案请查看我答案中的示例。。我一直在用它,非常喜欢。非常感谢。我试着做点什么。。。请看我编辑的问题。