I have an HTML structure like this:
<svg>
<path/>
</svg>
<img/>
Is there a way to do something like "display:block;" to the <img/> when <path/> is hovered, with CSS only?
This is only possible if it is possible to select the parent of <path/>
which unfortunately is not possible, so your answer is this is not possible.
If you would like to try this with javascript I can provide you a jQuery (not the best) example.
$('svg > path').hover(function(){
$(this).parent().next().addClass('hover');
}, function() {
$(this).parent().next().removeClass('hover');
});
Then in your css you can do.
img.hover{
// These styles take effect when you hover `<path>`
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With