Steve,

Of course 'index' is a more sensible label. I was just confused by your statement:

..."index" could be changed to anything we like...

and wanted to see if my example is what you were talking about, or if I missed something else.

Chris

Steve Jones wrote:
Hi Chris,

Not quite - In your example, THIS would work:

  $("a.open_button").each(function(jQueryRocks) {
    $(this).click(function() {
      $('div.section:eq(' + jQueryRocks +
')').slideToggle(1200,function() {
        complete(jQueryRocks);
      });
      return false;
    });
  });

So, each is passing the reference to each object position as "jQueryRocks" now instead of "index" - but it DOES need to be consistent throughout the function.

"index" is just a more sensible label than "jQueryRocks" !!

Cheers

SJ


On 20 Jan 2007, at 18:05, Christopher Jordan wrote:

Thanks Steve, that does make sense... mostly. I'm confused by the following:

"index" could be changed to anything we like, as it is only for the
purpose of passing a reference to the function.
What do you mean by this? Do you mean that I don't have to use the word
index? Like this:

  $("a.open_button").each(function(index) {
    $(this).click(function() {
      $('div.section:eq(' + jQueryRocks +
')').slideToggle(1200,function() {
        complete(index);
      });
      return false;
    });
  });

I'm not thinking that's what you meant. Otherwise, I think I understand
what you're saying.

Thanks,
Chris

--http://cjordan.info


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/












_______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/

-- 
http://cjordan.info


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to