1

我知道我错过了一小部分......但是对于这样的标记:

<a class="menusegment"><div>Link Text & Link Description</div></a>

我有以下jquery

$('a.menusegment').hover(function () {
    // insert code here
});

我想要做的是更改'a.menusegment'中包含的div的顶部边框颜色

任何帮助将不胜感激。

谢谢!

4

3 回答 3

3
$(function(){
    $('a.menusegment').hover(function () {
        var thisNode = $(this);
        thisNode.children('div').css('border-top', '1px solid #f60');
    });
});
于 2011-11-07T02:44:02.757 回答
2
$('a.menusegment div').hover(function (e) {
    e.stopPropagation();

    // change color here
},
function(){
//code to execute on mouseleave
}
);

http://jsfiddle.net/3Bh5J/

于 2011-11-07T02:15:44.923 回答
2

如果我理解你的问题......你不需要任何类型的 js

在 CSS 中:

a.menusegment:hover div{
border-top:solid red 1px;
}
于 2011-11-07T02:35:34.770 回答