日期:2014-05-16  浏览次数:20393 次

jquery 通过父级 修改子级 CSS
jQuery(document).ready(function($){
$(".goods ul li .imgTitleBg").hover(function() {
$(this).css("background-color","#201025");
},function(){
$(this).css("background-color","#ffffff");
});
});
写的这个能改变但不是想要的效果。  
想要的效果是 :hover  li 的时候 调出来 子级(imgBg) 的背景色。急求。在线等!
移开的时候 没有。

------解决方案--------------------
下面这样可以不?

jQuery(document).ready(function($){
    $(".content_left dl dd").hover(function() {
        var _this = $(this);
        _this.css("border","2px solid #d40070");
        $('.imgTitleBg1' , _this).css("background-color","#d40070");
    },function(){
        var _this = $(this);
        _this.css("background-color","#2a2a2a");
        $('.imgTitleBg1' , _this).css("border","2px solid #2a2a2a");
    });
});