0
以下是我的代码,但我再次遇到问题,我在该网站上有多个按钮,当您将鼠标悬停在类contentAddToCart上时,它们全都弹出。我该如何做到这一点,只要你悬停在显示器上。Jquery显示隐藏
jQuery的
$('.contentAddToCart').hover(function(){
$('.contentPosterBackgroundIcon').show(); },
function(){ $('.contentPosterBackgroundIcon').hide();
});
HTML
<div class="contentPosterBackgroundIcon sprite"></div>
<a class="contentAddToCart" href="">Buy Now<span></span></a>
CSS
.sprite {
background: url('sprite.png');
}
.contentPosterBackgroundIcon {
position: absolute;
background-position: -87px -104px;
display:block;
height:25px;
width:7px;
top: 22px;
left: 88px;
display: none;
}
我想如果我做了以下内容,将解决这个问题,但也许我不理解的东西:
$('.contentAddToCart').hover(function(){
$('.contentPosterBackgroundIcon', this).show(); },
function(){ $('.contentPosterBackgroundIcon', this).hide();
});
ahhh我看到谢谢 – Jacinto