感谢这篇文章,这是我所做的:
var current = null;
for (var state in fr) {
(function (st, state) {
st[0].state = 0;
st[0].onmouseover = function() {
st[0].style.cursor = "pointer";
current && fr[current].animate({fill: "#EAEAEA", stroke: "#d5d5d5"}, 300);
st.animate({fill: "#EC5505", stroke: "#EC5505"}, 300);
st.toFront();
paper.safari();
document.getElementById(state).style.display = "block";
current = state;
};
st[0].onmouseout = function () {
if (this.state == 0)
st.animate({ fill: "#EAEAEA", stroke: "#D5D5D5" }, 500);
else
st.animate({ fill: "#EC5505", stroke: "#EC5505" }, 500);
st.toFront();
paper.safari();
};
st[0].onclick = function () {
st.animate({ fill: "#EC5505", stroke: "#EC5505" }, 500);
st.toFront();
if (this.state == 0) {
this.state = 1;
}
else
this.state = 0;
paper.safari();
};
})(fr[state], state);
}
我有一些问题......当我点击一个区域然后悬停(在悬停时填写#EC5505)这个区域时,该区域会返回#EAEAEA半秒然后返回#EC5505......通常,这个单击时应该保持悬停颜色...第二个问题是我只想选择一个区域。所以当我点击第二个区域时,第一个区域必须回到初始状态。
你可以帮帮我吗 ?非常感谢