yeah, that looks a lot like what I posted yesterday before I had a chance to see the HTML:

For the sake of discussion, I'll assume that your "section" divs immediately follow the buttons and that we can get by with some other way of referencing whatever "index" is being used for:

$('a.open_button').click(function() {
  $(this).next().addClass('open').slideToggle(1200,function() {
    complete(something);
  });
  return false;
});


Joan's solution won't work (as you already discovered) because it refers to "complete(index)", and there is no index being passed through, as there was with the .each(index) method.


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Jan 21, 2007, at 3:26 AM, Steve Jones wrote:

Hi Joan

I tried that, but couldn't get it to work on either FFox or Safari on my Mac. It looks like the ultimate in elegance, though, so I plan to look through the docs a bit more to see if I can figure out a workaround.

Thanks

Steve J





On 21 Jan 2007, at 4:59, Joan Piedra wrote:

I think this should work. Not tested tho.

  $("a.open_button").click(function() {
     $(this).next('div.section').slideToggle(1200,function() {
        complete(index);
      });
      return false;
  });

Cheers


On 1/20/07, Steve Jones < [EMAIL PROTECTED]> wrote:
   $("a.open_button").each(function(index) {
     $(this).click(function() {
$('div.section:eq(' + index + ')').slideToggle(1200,function () {
         complete(index);
       });
       return false;
     });
   });



--
Joan Piedra || Frontend webdeveloper
http://joanpiedra.com/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/






<new-logo-small.gif>


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

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

Reply via email to