我目前正在使用jquery-animate-colors来为边框的闪烁设置动画,但我认为我的代码可以使用一些清理.有什么方法可以解决以下问题?
highlightRow = function(row, count) {
if (count == null) {
count = 0;
}
$(row).animate({
"border-color": "#3737A2"
}, {
duration: 250,
complete: function() {
return $(row).animate({
"border-color": "#FFFFFF"
}, {
duration: 250,
complete: function() {
if (count === 0) {
return highlightRow(row, count += 1);
}
}
});
}
});
};
Run Code Online (Sandbox Code Playgroud)
所以我试着让它只是两次打开和关闭边框颜色.我发现尝试动画border-color,除了十六进制代码之外你不能使用任何东西.transparent并且none两者都没有动画任何东西.
无论如何,寻找一些帮助来清理这个!谢谢你:)
我试图让fadeIn(不透明度切换)和边框淡入淡出(使用jquery-animate-colors)同时触发但我遇到了一些麻烦.有人可以帮助查看以下代码吗?
$.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
Run Code Online (Sandbox Code Playgroud)
真的很感激.谢谢!