[jQuery] Re: Passing arguments to Hover and Toggle??

2007-09-01 Thread Andy Matthews
Beautiful Mike...that's exactly what I was wanting to know. Thanks a lot! On Sep 1, 11:20 am, "Michael Geary" <[EMAIL PROTECTED]> wrote: > > > > Is there a way to pass arguments from one anonymous function, (in > > > > either Toggle, or Hover) to the second? > > > Closures are your friend: > > >

[jQuery] Re: Passing arguments to Hover and Toggle??

2007-09-01 Thread Michael Geary
> > > Is there a way to pass arguments from one anonymous function, (in > > > either Toggle, or Hover) to the second? > > Closures are your friend: > > > > $('a.display').each(function() { > > var $this = $(this), size = $this.attr('href'), toggle = $('.' + size); > > $this.toggle(func

[jQuery] Re: Passing arguments to Hover and Toggle??

2007-09-01 Thread Andy Matthews
Thanks for the confirm Richard...and I assume that all 3 of those would be var'd because they're on the same line? On Sep 1, 10:32 am, "Richard D. Worth" <[EMAIL PROTECTED]> wrote: > On 9/1/07, Andy Matthews <[EMAIL PROTECTED]> wrote: > > > > > Hang on...now that I look at it, I think I understan

[jQuery] Re: Passing arguments to Hover and Toggle??

2007-09-01 Thread Richard D. Worth
On 9/1/07, Andy Matthews <[EMAIL PROTECTED]> wrote: > > > Hang on...now that I look at it, I think I understand #4. Is this > line: > > var $this = $(this), size = $this.attr('href'), toggle = $('.' + > size); > > the same as these lines: > var $this = $(this) > var size = $this.attr('href') > var

[jQuery] Re: Passing arguments to Hover and Toggle??

2007-09-01 Thread Andy Matthews
Hang on...now that I look at it, I think I understand #4. Is this line: var $this = $(this), size = $this.attr('href'), toggle = $('.' + size); the same as these lines: var $this = $(this) var size = $this.attr('href') var toggle = $('.' + size); ? On Sep 1, 9:41 am, Andy Matthews <[EMAIL PROT

[jQuery] Re: Passing arguments to Hover and Toggle??

2007-09-01 Thread Andy Matthews
Klaus... A few questions. 1) I'm assuming from your reply that there's no way to do this with plain ole hover/toggle then? 2) What is a closure? 3) Is there any performance hit when doing .each (then toggle) versus just doing .toggle? 4) Can you explain this line please? var $this = $(thi

[jQuery] Re: Passing arguments to Hover and Toggle??

2007-09-01 Thread Klaus Hartl
Andy Matthews wrote: Is there a way to pass arguments from one anonymous function, (in either Toggle, or Hover) to the second? Ideally I'd like to be able to pass in whatever variables I choose, but I'd settle for being able to pass in $(this), the item that triggered the event. Here's the code

[jQuery] Re: Passing arguments to Hover and Toggle??

2007-08-31 Thread Sergei
Try this: .toggle( function() { myFunction(this, parameters...); } ) And you should define myFunction somewhere else. On 1 сент, 14:28, Andy Matthews <[EMAIL PROTECTED]> wrote: > Is there a way to pass arguments from one anonymous function, (in > either Toggle, or Hover) to the second? Ideally