链接的jsfiddle:http://jsfiddle.net/crismanNoble/gqFdH/2/.mouseover()事件怪怪
基本上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');
});
});
不在我的浏览器中... – Boldewyn
我在Greg Pettit的建议后更新了小提琴。原稿:http://jsfiddle.net/crismanNoble/gqFdH/2/ – Crisman
这将是很好的提及更新;当你打开它时会感到困惑,并且它可以正常工作。 – Vlad