Check to see if the element is already visible/invisible and exit on
that condition:

if(Element.visible(elt)) {
  return;
}

On Sep 16, 9:43 am, beachcomber <[EMAIL PROTECTED]> wrote:
> Hi this is probably a very simple error but I just cannot see a was to
> fix it. below is a very simple show/hide script however the functions
> continually fires causing the menu to "flicker"
>
> function menuShow(e){
>
>         var elt = e.element();
>         if(elt.tagName=='A'){
>                 elt = elt.next();
>                 if(elt.tagName=='DIV'){
>                         elt.removeClassName('hidden');
>                 }
>         }
>
> }
>
> function menuHide(e){
>
>         var elt = e.element();
>         console.log (elt.tagName);
>         if(elt.tagName=='A'){
>                 console.log ('goodbye World');
>                 elt = elt.next();
>                 console.log(elt);
>                 if(elt.tagName=='DIV'){
>                         elt.addClassName('hidden');
>                 }
>         }
>
> }
>
>         $('mainMenuContainer').observe('mouseover', menuShow);
>         $('mainMenuContainer').observe('mouseout', menuHide);
>
> });
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to