链接到jsfiddle:http://jsfiddle.net/crismanNoble/gqFdH/2/
基本上,svg会不断改变颜色,而从未触发.mouseout事件。
$(function() {
$(".icon")
.mouseover(function() {
var colors = ["#6F216C", "#F34B0D", "#C50102", "#5DA537", "#F1D81B"];
var pick = Math.floor(Math.random()*5);
var color = colors[pick];
$(this).children().css('fill',color);
})
.mouseout(function() {
$(this).children().css('fill','black');
});
});