Raphael.js map default fill colors
Posted
by
RIDER
on Stack Overflow
See other posts from Stack Overflow
or by RIDER
Published on 2012-10-22T18:11:52Z
Indexed on
2012/11/25
5:04 UTC
Read the original article
Hit count: 309
I am trying to familiarize myself with raphael.js. I want to create a USA map that already has default colors for each state and those colors stay there.
Here is what I came up with.
If you look at AK, I'm getting the default color loaded, but if I highlight another state, the default color for AK disappears. I want AK - and other states - to stay the same color.
Specifically, I don't know what is clearing out my AK full color. I think part of this statement is clearing out the fill cover when I mouseover a different state:
for (var state in aus) {
//aus[state].color = Raphael.getColor();
(function (st, state) {
st[0].style.cursor = "pointer";
st[0].onmouseover = function () {
current && aus[current].animate({fill: "#333", stroke: "#666"}, 500) && (document.getElementById(current).style.display = "");
st.animate({fill: st.color, stroke: "#ccc"}, 500);
st.toFront();
R.safari();
document.getElementById(state).style.display = "block";
current = state;
};
})(aus[state], state);
}
Any ideas where I might be going wrong?
© Stack Overflow or respective owner