This is really weird and should be simple.
I have an array of images within a tags within a div, eg:
<div id="images">
<a href="#"><img src="img1.jpg"/></a>
<a href="#"><img src="img2.jpg"/></a>
<a href="#"><img src="img3.jpg"/></a>
</div>
I want to hide all of them, but loop through and show the nth one, so I created this image slider style script:
var atags = $('#images').children().length;
$('#images').children().hide();
$('#images a:first').show();
var i=0
while (i <= atags){
$('#images').children().delay(4000).hide();
$("images:nth-child(" + i + ")").show();
i = i + 1;
}
The issue is that no other a tags, despite the first out side the loop, get displayed. They all remain hidden dispite the .show(). It appears the line $("images:nth-child(" + i + ")").show();
just doesnt work.
Can anyone point me in the right direction with this?