I have a map of Brazil, in an SVG, where I would like to present a div
to each state when clicking on it.
I managed to work with color change with hover
using ID
of each state of Brazil:
function highlight_map_states(){
if($(".states_section").length>0){
$(".states_section .list_states .item .link").hover(function(){
var a="#state_"+$(this).text().toLowerCase();
$(a).attr("class","state hover")
},function(){
var a="#state_"+$(this).text().toLowerCase();
$(a).attr("class","state")
})
}
};
How do I get a click on each state to make a div
appear?
Note: You can not put all the code here because the question has a maximum character size, but there's a demo on Codepen .