简体   繁体   English

更改菜单项鼠标悬停时标题底部边框的颜色

[英]Change header bottom border color on menu item mouse hover

I need to change the border bottom color of header bottom when I go over a menu item voice. 当我浏览菜单项语音时,需要更改标题底部的边框底部颜色。

I tried a script I found but I'm not able to modify it correctly. 我尝试了找到的脚本,但是无法正确修改它。 Please help me. 请帮我。 This is the code I try to use but I don't know how to correctly write the class. 这是我尝试使用的代码,但我不知道如何正确编写该类。

jQuery (document).ready(function(){
jQuery ( "nav.main_menu > ul > li > a" )
.mouseenter(function() {
jQuery (".header_bottom").css("border-bottom","4px solid #d1007e;");
})
.mouseleave(function() {
jQuery (".header_bottom").css("border-bottom","4px solid #1d1d1b;");
});
});

When I go over each menu voice I want that header bottom border color change from #1d1d1b to #d1007e. 当我遍历每个菜单语音时,我希望标题底部边框的颜色从#1d1d1b变为#d1007e。

Try this in your css.. 在您的CSS中尝试此操作。

.class_name:hover{
   border-bottom:4px solid #d1007e;
}

Remove the semicolon(;) from the CSS property value. 从CSS属性值中删除分号(;)。

$(document).ready(function(){
    $( "nav.main_menu > ul > li > a" ).on('mouseenter',function() {
        $(".header_bottom").css('border-bottom','4px solid #d1007e');
    }).on('mouseleave',function() {
        $(".header_bottom").css("border-bottom","4px solid #1d1d1b");
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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