[jQuery] Re: how to bind one action to multiple events?

2008-02-04 Thread [EMAIL PROTECTED]
Update: A more accessible hover function. I did my homework, then did this: // a more accessible hover function jQuery.fn.extend({ hover: function(fnOver, fnOut) { return this.bind('mouseenter mouseover focus', fnOver).bind('mouseleave mouseout blur', fnOut); }

[jQuery] Re: how to bind one action to multiple events?

2008-02-03 Thread Brandon Aaron
With jQuery 1.2.2 you can now bind multiple events at once. Just separate them with a space. I'd also suggest using the new mouseenter and mouseleave events. $('a') .bind(mouseenter focus mouseleave blur, function(event) { console.log(event.type); }); -- Brandon Aaron On Feb 3,

[jQuery] Re: how to bind one action to multiple events?

2008-02-03 Thread Hamish Campbell
$('mySelector').mouseover(function() { // do something on mouseover and focus }) .focus(function(){ // trigger the mouseover event on focus $(this).trigger('mouseover') }); On Feb 4, 7:31 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ... at least, that's what I think I need to do!

[jQuery] Re: how to bind one action to multiple events?

2008-02-03 Thread [EMAIL PROTECTED]
Thanks a million, Brandon - and for your blog, which I'm keeping permanently open! Doing as you suggested above wouldn't put the 'up' image back on mouseout (my syntax was probably wrong), though I did manage to get it working by doing it the long way . Then I rewrote the core :/

[jQuery] Re: how to bind one action to multiple events?

2008-02-03 Thread [EMAIL PROTECTED]
Ooohh, that's neat! Blimey, I'm learning a lot Thanks, Hamish :) On Feb 3, 8:01 pm, Hamish Campbell [EMAIL PROTECTED] wrote: $('mySelector').mouseover(function() { // do something on mouseover and focus}) .focus(function(){ // trigger the mouseover event on focus