[UPHPU] jquery: hover(over,out)
Joseph Scott
joseph at randomnetworks.com
Mon Dec 8 20:59:55 MST 2008
On Dec 8, 2008, at 7:47 PM, Wade Preston Shearer wrote:
> Can anyone explain to me why this:
>
> function banana() {
> alert('banana function called');
> }
>
> $('tr').hover(
> function() {
> banana();
> },
> function() {
> banana();
> }
> );
>
>
> …works, but this…
Because that's the way the jQuery hover() function works:
http://docs.jquery.com/Events/hover#overout
> function banana() {
> alert('banana function called');
> }
>
> $('tr').hover(banana(), banana());
>
>
> …does not?
Because hover() takes Functions as arguments, and what you are doing
is calling the functions when setting up the hover event.
--
Joseph Scott
joseph at josephscott.org
http://josephscott.org/
More information about the UPHPU
mailing list