gpt4 book ai didi

jquery - 如何在 TD 中选择 IMG?

转载 作者:太空宇宙 更新时间:2023-11-03 21:48:05 24 4
gpt4 key购买 nike

这是我的 jQuery 代码...

<script>
$(document).ready(function(){
$("gallery", Image).hover(function(){
$(this).stop().animate({ opacity: 1.0 }, 800);
});
});
</script>

我的 HTML...

<table class="gallery">
<tr>
<td>
<img src="photo.jpg">
</td>
</tr>
</table>

我的 CSS...

.gallery img {
opacity: 0.5;
filter: alpha(opacity=50);
}

当我执行鼠标悬停时,我希望“图库”表中的任何图像将不透明度更改为 1.0。我确定我的语法是错误的。我可以做我想做的事吗?我不想为每个图像指定类。

最佳答案

您需要在开始时用 . 指定一个类,然后引号中的任何内容都将是子元素:

$(".gallery img").hover(function(){

关于jquery - 如何在 TD 中选择 IMG?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19306696/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com