I'm not sure that I follow that but one thing that might help is to
store JSON objects in the array instead of just the src:

$( ".images img" ).each( function(i) {
   imgArray.push(
    src: $(this).attr( "src" ),
    key: i
 );
});

Then, when retrieving the new src you can also get the key/index.

On Tue, Jan 12, 2010 at 3:30 AM, knal <knalp...@gmail.com> wrote:
> Hi there,
>
> I'm trying to build a custom slideshow (which doesn't loop) but i seem
> to be unable to iterate through the array of images correctly.
>
> Content looks like
>
> <div class="images">
>    <img src="1.jpg">
>    <img src="2.jpg">
>    etc....
> </div>
>
> I create an array of images as follows
>
> $( ".images img" ).each( function() {
>    imgArray.push( $(this).attr( "src" ) );
> });
>
> All images except for img:first are hidden, and to change slides i
> change img:first's src-attribute with a fade (hope it's clear).
> Now i'd like to check img:first's current src-attribute and then
> define it's key in the array.
>
> I hope this kind of makes sense. Any help will be greatly appreciated!
>
> Thanks,
> Knal
>

Reply via email to