Maybe I'm missing something but I don't see the difficulty here. 
There's definately no need to do excessive core hacking or chaining of 
mouseover and mouseout...

Why not just:

function myFunction()
{
 $(this).append(' hover!');
}

And then:

$('#hoverelem').hover(myFunction,myFunction);

or... ?

Same goes with other jQuery event functions that takes functions as parameters. 
They don't necessarily need to be dynamic and defined right then and there, you 
can just provide a pointer to the function instead. If you want to pass in 
additional parameters, most likely stuff that you can't get from the targeted 
element (this) or the event object, then you might need to wrap some stuff in a 
dynamic function.

-- 
Suni


  ----- Original Message ----- 
  From: Aaron Heimlich 
  To: jQuery Discussion 
  Sent: Wednesday, March 28, 2007 1:02 AM
  Subject: Re: [jQuery] bind two events to same function


  On 3/27/07, David Dexter <[EMAIL PROTECTED]> wrote:
    Have a look at the hover() function it does exactly what you are looking
    for.


  Actually, it doesn't. hover() expects two different functions. From the API 
docs:

  "Whenever the mouse cursor is moved over a matched element, the first 
specified function is fired. Whenever the mouse moves off of the element, the 
second specified function fires." 

  Source: http://docs.jquery.com/Events#hover.28_over.2C_out_.29

  What Josh wants to do is bind the *exact same function* to do different 
events (which is what I showed him how to do). 

  -- 
  Aaron Heimlich
  Web Developer
  [EMAIL PROTECTED]
  http://aheimlich.freepgs.com 


------------------------------------------------------------------------------


  _______________________________________________
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to