将鼠标悬停在子元素上时设置父元素的样式

style parent element when hover on children element

我有一个 2 级下拉菜单。 在第一层悬停时,第二层是可见的,我在父级上放置了一个底部边框。但是当我进入第二层时,边框不适用,我希望将鼠标悬停在子元素上时它也适用。 谢谢

我用 jQuery

$x('.dropdown-menu')
.mouseenter(function(){
    $x(this).each(function() {
        $x(this).parent().css('border-bottom','1px solid #e36161');
    })
})
.mouseleave(function(){
    $x(this).each(function() {
        $x(this).parent().css('border-bottom','none');
    })
});

没关系