Generic menu events: mouseover, out, click. I always do menus the same
way, no problems. Only I would like to be able to eliminate that
guessing row.

A tipical setup:

this.buttons.addEvents({
                        'mouseover':function(e){
                                var t = ($(e.target).match('li')) ? $(e.target) 
: $
(e.target).getParent('li');
                                //do something with t
                        }.bindWithEvent(this),

                        'mouseout':function(e){
                                [...]
                        }.bindWithEvent(this)
});

On 29 Giu, 11:03, Fábio M. Costa <[email protected]> wrote:
> Whats the event?
> Is it something related to mouseenter/mouseleave?
>
> --
> Fábio Miranda Costa
> Solucione Sistemas
> Engenheiro de interfaces
> Twitter: fabiomirandahttp://solucione.info
>
> On Tue, Jun 29, 2010 at 6:01 AM, chone <[email protected]> wrote:
> > try to add event listener to LI element,
> > and prevent browser default event to A element?
>
> > 2010/6/29 stratboy <[email protected]>
>
> > Hi! I always have a tedious issue when adding events to menus.
> >> Obviously, I always have links inside <li> elements. A often need to
> >> attach events to the <li> elements insted of <a>. The problem is that
> >> this way, e.target is always == to the <a> elem., not to <li>, because
> >> of capture phase, I guess, so I always have to do something like this:
>
> >> var t = ($(e.target).match('li')) ? $(e.target) : $
> >> (e.target).getParent('li');
>
> >> Nothing very bad, but, I was wondering.. Is there a way to stop
> >> capture instead of bubbling, so I get directly the <li> event?
>
> >> Thanks

Reply via email to