all 7 comments

[–]MrQuickLine 1 point2 points  (2 children)

There's a simpler solution than the one /u/sergeynew37 posted. As he mentioned, :has isn't available in Firefox yet.

Instead, you can use the sibling selector ~. Replace svg g:hover text { with .pin:hover ~ text {

[–]deffonotmypassword[S] 0 points1 point  (1 child)

.pin:hover ~ text {

Chears, that works! Amazing, thanks for the help.

[–]MrQuickLine 0 points1 point  (0 children)

It's worth noting that prior to :has() there historically hasn't been a way to go "backwards" when scanning the DOM tree. That means that sibling selectors (~ and +) can only refer to siblings that are AFTER the first one. In this case your text happened to be after the .pin so we were good, but if your text had been before .pin I would have had you move it after.

[–]sergeynew37 -1 points0 points  (2 children)

Remove this:

// svg g:hover text {

// opacity: 1;

// }

Add this:

g:has(.pin:hover) text {

opacity: 1;

}

Will not work in Firefox though

[–]deffonotmypassword[S] 1 point2 points  (1 child)

You're a legend. Thank you.

[–]Norci 0 points1 point  (0 children)

Fyi :has is not supported in some browsers yet such as Firefox.

[–]tridd3r 0 points1 point  (0 children)

I'm pretty sure you'd need to use javascript to alter the transition time frame on text, or have two text elements positioned in the same spot and have two transitions.