[jQuery] Re: Find array key of value

2010-01-12 Thread Šime Vidas

How does the user select which image he wants to view?


[jQuery] Re: Find array key of value

2010-01-12 Thread knal
@Sime
The user is going to click 'Previous'  'Next' links...

@Brian
I have my images in an array (retrieved from the source, thanks for
the tip)
When i read the SRC from the current image, i want to know it's
location in the array.
This way i could either subtract 1 or add 1 to the current indexkey so
i know what image
was before or comes next.

Hope it's kind of clear, i don't completely know how to explain...

On Jan 12, 1:14 pm, Šime Vidas sime.vi...@gmail.com wrote:
 How does the user select which image he wants to view?


Re: [jQuery] Re: Find array key of value

2010-01-12 Thread Karl Swedberg


On Jan 12, 2010, at 7:32 AM, knal wrote:


@Brian
I have my images in an array (retrieved from the source, thanks for
the tip)
When i read the SRC from the current image, i want to know it's
location in the array.
This way i could either subtract 1 or add 1 to the current indexkey so
i know what image
was before or comes next.

Hope it's kind of clear, i don't completely know how to explain...



You could use $.inArray()

something like:
$.inArray('/some/src/value.jpg', imgSrc);

more info:
http://api.jquery.com/jQuery.inArray/


--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com



[jQuery] Re: Find array key of value

2010-01-12 Thread knal
Great!! That has to solve my quest!

On Jan 12, 3:31 pm, Karl Swedberg k...@englishrules.com wrote:
 On Jan 12, 2010, at 7:32 AM, knal wrote:

  @Brian
  I have my images in an array (retrieved from the source, thanks for
  the tip)
  When i read the SRC from the current image, i want to know it's
  location in the array.
  This way i could either subtract 1 or add 1 to the current indexkey so
  i know what image
  was before or comes next.

  Hope it's kind of clear, i don't completely know how to explain...

 You could use $.inArray()

 something like:
 $.inArray('/some/src/value.jpg', imgSrc);

 more info:http://api.jquery.com/jQuery.inArray/

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com