我已经尝试了我能找到的所有可能的组合,但它仍然不起作用。我正在尝试选择第一、第二、第三...图像并更改 CSS 属性。
JavaScript:
$("#slider:eq(0)")filter(img).css("display","none");
$("#slider:eq(0)")filter(img).css("visibility","hidden");
的HTML:
<div id = "slider">
<img id = "slider_img5" class = "slider_image" src = "img/slider_image_5.png" width = "1000px" height = "400px" alt = "slider_image_5">
<img id = "slider_img4" class = "slider_image" src = "img/slider_image_4.png" width = "1000px" height = "400px" alt = "slider_image_4">
<img id = "slider_img3" class = "slider_image" src = "img/slider_image_3.png" width = "1000px" height = "400px" alt = "slider_image_3">
<img id = "slider_img2" class = "slider_image" src = "img/slider_image_2.png" width = "1000px" height = "400px" alt = "slider_image_2">
<img id = "slider_img1" class = "slider_image" src = "img/slider_image_1.png" width = "1000px" height = "400px" alt = "slider_image_1">
</div>
CSS:
#slider{
position : absolute;
height : 400px;
width : 100%;
border-radius : 3px;
-moz-border-radius : 3px;
box-shadow : 1px 1px 5px #bbbbbb;
-moz-box-shadow : 1px 1px 5px #bbbbbb;
}
.slider_image{
position : absolute;
top : 0px;
left : 0px;
border-radius : 3px;
-moz-border-radius : 3px;
}
#slider_img1 , #slider_img2 , #slider_img3 , #slider_img4{
visibility : hidden;
display : none;
}
我希望有一个人可以帮助我。
更新 1
感谢您提供所有答案,但没有一个有效。我正在调用文档准备好的函数,它肯定被调用(用 测试alert();
)。我还预设了所有图像的样式,因此除了第一个之外,它们都被隐藏了。
更新 2
对不起,伙计们,少了一个分号。谢谢大家的帮助!