有试图让这个jQuery代码工作的问题。这个想法是,当图像被突出显示时,不透明度应该改变。现在它正在使用smallartcov类标记来更改不透明度。问题在于它上面有一些文字。所以文本算作离开图像区域的鼠标,即使它从未做过。我怎样才能解决这个问题?jquery悬停图像和文本问题
http://169.231.6.197/vathom/artist.php是测试主题托管的地方。如果你看@最右边的图片,你可以看到我的意思。下面是HTML我们有它:
<div class="artistg">
<div class="smallartcov"></div><span class="smallarttxt">702</span>
<img class="smallartpic" src="images/df.jpg" />
</div>
有以下的jQuery一起:
<script type="text/javascript">
$('.smallartcov').hover(function() {
$(this).css('color', 'white');
$(this).css('opacity', '0');
}, function() {
$(this).css('color', 'white');
$(this).css('opacity', '0.5');
});
</script>
任何想法?非常感激。
你的意思是计数应该增加悬停,应该记住任何新的页面请求? – Ankit 2012-04-24 05:08:27
确保你的DOM加载脚本准备好了 – elclanrs 2012-04-24 05:09:32
你想隐藏文本? – Jack 2012-04-24 05:12:26