I need some help with this jQuery code. I have a SVG map, and I need a to select a country with one click, and deselect it with another one. Can somebody help me ? :) This is the code:
<script type="text/javascript">//<![CDATA[
$(window).load(function(){
$(document).ready(function() {
$("path").mouseover(function() {
$(this).css('cursor', 'pointer');$(this).attr({
fill: "#FF0000",
stroke: "#00FF00"
});
$(this).css('cursor', 'pointer');
})
.mouseout(function(){
if(!$(this).data('clicked')){
$(this).attr({
fill: "#FFFFFF",
stroke: "#eee"
});
}
});
$("path").click(function() {
$(this).attr({
fill: "#FF0000",
stroke: "#00FF00"
});
$(this).data('clicked', true);
});
});
});//]]>
</script>