多个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);
});
});
这个关于并行动画的答案请查看我答案中的示例。。我一直在用它,非常喜欢。非常感谢。我试着做点什么。。。请看我编辑的问题。