VeryNice
unread,Dec 3, 2009, 5:24:43 AM12/3/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Raphaël
It is done!
Not adding the class name, but the workaround using the
htmlhttprequest for the map.
Thanks to Charles for pointing out to the solution.:
window.onload = function () {
var R = Raphael("paper", 330, 320);
var attr = {
fill: "#c0000f",
stroke: "#fff",
"stroke-width": 0.8,
"stroke-linejoin": "miter"
};
var canada = {};
canada.pei = R.path("M 289.4,272 C 286.6,271.8 283.9,271.2 281.1,270.6
C 280.1,270.6 280,270.2 280.6,268.9 C 281,268.1 281.4,267.6
281.6,267.6 C 282.6,268.2 283.5,269.1 284.5,269.4 C 286.6,269.2
288.7,268.2 290.9,268 C 290.7,268.9 290.4,269.8 290.2,270.7 C
290.2,271.7 289.8,272.3 289.4,272 z").attr(attr);
//PATH INFO FOR OTHER PROVINCES ALSO GO HERE, but have been left out
because it is a very long code.
var current = null;
for (var prov in canada) {
canada[prov].color = Raphael.getColor();
(function (st, prov) {
st[0].style.cursor = "pointer";
st[0].onmouseup = function () {
current && canada[current].animate({fill:
"#c0000f", stroke: "#fff"}, 500) && (docClickLoader.loadInto(current+'-
job-listings.html', 'targetArea'));
st.animate({fill: "#ffff38", stroke:
"#c0000f"}, 500);
st.toFront();
R.safari();
docClickLoader.loadInto(prov+'-job-
listings.html', 'targetArea');
current = prov;
};
})(canada[prov], prov);
}
};
For this to work you need to include latest version of raphael
(currently1.2.4) and htmlhttprequest.js codes need to be added
properly to your page. The external files you are calling need to end
with -job-listings.html (just kidding, you can change this as you
like), but they have to be named or begin with province name that you
used for naming the svg path. For example, the file this code would
load is named pei-job-listings.html
I post this code here, because it will be hard to see what is going on
on my website, since I plan to put all css and js code in external
files soon.
Thanks again, and good luck you all!