I'm currently working on creating an interactive SVG map. I have successfully incorporated code from Illustrator into an HTML file and managed to change the fill color of certain paths when hovering over them. However, I am facing an issue where a white rectangle and text are blocking the interaction with my path elements. My objective is to allow for hover effects on text, white backgrounds, and paths so that the paths always fill in a specific color (#ff7bac).
Below is a snippet of my SVG code:
<a xlink:href="http://travelalberta.com" id="wohnrauemeLink">
<g id="wohnraeume">
<g id="wohnraeumeFill">
<g>
<path class="eckig" d="M1169,124.5v341.1h429V124.5H1169z M1390.5,445h-199.4l0-68.7h71v33.9h128.4V445z"/>
</g>
</g>
<polygon id="wohnrauemeWhite" fill="#FFFFFF" points="1191.3,445.6 1191.2,372.3 1262.3,372.3 1262.2,410.1 1391,411.3
1390.5,445.7 "/>
</g>
</a>
Here is the CSS associated with it:
path.eckig {
fill: #FFFFFF;
opacity: 0;
transition: .6s fill;
}
path.eckig:hover {
fill: #ff7bac;
opacity: 1;
}
I would greatly appreciate any assistance as I have been stuck on this issue for a few days now.
******************** Edit *********************
Hello there :)
I am still trying to resolve this problem, so here is a simplified version:
https://jsfiddle.net/4tjzk8z5/11/
The main goal is to change the color of the red rectangle when hovering over the blue rectangle.
I attempted using JavaScript this time, but unfortunately, it did not work:
function mouseoverblue(){
var myPara = document.getElementById("red");
myPara.style.color = "#123444";
}
Thank you in advance for any help you can provide!