ianbeks
ianbeks

Reputation: 2228

Keep hover style on parent when hovering over a tooltip that is NOT a descendant

I have a "parent" div that contains an element with a tooltip control. The tooltip is not child element of the parent div and is attached directly to the body element. We have a style when hovering over the parent which is lost when hovering over the tooltip. Is there a CSS-based solution for keeping the hover style on the parent while hovering over the tooltip that is not a descendant of the parent?

Upvotes: 0

Views: 373

Answers (1)

Jack Bashford
Jack Bashford

Reputation: 44145

Just change this:

#parent:hover {
    /*show tooltip*/
}

To this:

#parent:hover, #tooltip:hover {
    /*show tooltip*/
}

Upvotes: 1

Related Questions