我正在尝试同时获得淡入(不透明度切换)和边框淡入(使用jquery 动画颜色 http://www.bitstorm.org/jquery/color-animation/)同时开火,但我遇到了一些麻烦。有人可以帮忙查看以下代码吗?
$.fn.extend({
key_fadeIn: function() {
return $(this).animate({
opacity: "1"
}, 600);
},
key_fadeOut: function() {
return $(this).animate({
opacity: "0.4"
}, 600);
}
});
fadeUnselected = function(row) {
$("#bar > div").filter(function() {
return $(this).id !== row;
}).key_fadeOut();
return $(row).key_fadeIn();
};
highlightRow = function(row, count) {
return $(row).animate({
"border-color": "#3737A2"
}).animate({
"border-color": "#FFFFFF"
}).animate({
"border-color": "#3737A2"
}).animate({
"border-color": "#FFFFFF"
});
};
fadeUnselected("#foo");
highlightRow("#foo"); // doesn't fire until fadeUnselected is complete
真的很感激。谢谢!
默认情况下,JQuery 将动画放置在效果队列中,以便它们会一个接一个地发生。如果您希望动画立即发生,请设置queue:false
在您的动画选项地图中标记。
例如,在你的情况下,
$(this).animate({
opacity: "1"
}, 600);
会成为
$(this).animate(
{
opacity: "1"
},
{
duration:600,
queue:false
});
您可能希望使用选项图并设置边框动画的队列。
http://api.jquery.com/animate/ http://api.jquery.com/animate/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)