读书人

jquery 透过父级 修改子级 CSS

发布时间: 2013-02-27 10:48:11 作者: rapoo

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");
});
});

读书人网 >JavaScript

热点推荐