简体   繁体   中英

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?

Just change this:

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

To this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM