gpt4 book ai didi

jquery - 从同一类的图像列表中选择图像

转载 作者:行者123 更新时间:2023-12-01 02:29:54 27 4
gpt4 key购买 nike

我想在这里制作一个轮播。

这是我的标记

<img  class="fullBg anim" src="img/bgs/1.jpg" >
<img class="fullBg anim" src="img/bgs/2.jpg" >
<img class="fullBg anim" src="img/bgs/3.jpg" >
<img class="fullBg anim" src="img/bgs/4.jpg" >

现在我想选择该类的第一张图像或第二张图像,而不给每个图像一个 ID。请告诉我该怎么做。我尝试了n-th child,但没有成功。谢谢。

最佳答案

您需要将该 html 包装在父元素(如 div)中。然后尝试:

$(parentselector).find("img:eq(1)");//for second image
$(parentselector).find("img:eq(0)");//for first image

关于jquery - 从同一类的图像列表中选择图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21407819/

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