Loading ...
Sorry, an error occurred while loading the content.

onAvailable not working property in IE?

Expand Messages
  • Bryce Fischer
    Maybe I m not understanding the Event.onAvailable method, but it seems its firing before the entire contents are available. I have the following code: initMenu
    Message 1 of 3 , Sep 5, 2006
    • 0 Attachment
      Maybe I'm not understanding the Event.onAvailable method, but it seems
      its firing before the entire contents are available.

      I have the following code:

      initMenu = function() {
      items = this.getElementsByTagName("li");
      YAHOO.util.Event.addListener(items, 'mouseover', doMenuOver);
      YAHOO.util.Event.addListener(items, 'mouseout', doMenuOut);
      }

      YAHOO.util.Event.onAvailable('sidebar', initMenu);

      Which basically is adding mouse over/out events to a list.

      Here is my list:

      <div id="sidebar">
      <ul
      ><li><img src="images/menu_family.jpg" alt="Our Family Business" /></li
      ><li><img src="images/menu_directions.jpg" alt="Directions" /></li
      ><li><img src="images/menu_services.jpg" alt="Our Services" /></li
      ><li><img src="images/menu_service_special.jpg" alt="Making the
      Service Special" /></li
      ><li><img src="images/menu_preplanning.jpg" alt="Preplanning" /></li
      ><li><img src="images/menu_obits.jpg" alt="Obituaries" /></li
      ><li><img src="images/menu_condolences.jpg" alt="Condolences" /></li
      ><li><img src="images/menu_contact.jpg" alt="Contact Us" /></li
      ></ul
      >

      Now, the list is composed of images. I should mention this works like
      a charm in Firefox. In IE, however, only about 1/2 of the li's are
      getting set. Some debugging reveals that when the initMenu function is
      called, only about 1/2 of the li's are known. Its like IE's reporting
      that its available when its now?

      I've implemented a workaround where I put a 1/2 second pause before
      the initMenu function continues. I'm going to try to preload the
      images first, maybe that will work?

      Any other ideas? Suggestions?

      Thanks

      I can post the complete code if requests.
    • Adam Moore
      ... onAvailable fires when the element is accessible. This does not guarantee that its children are ready. If you know what the last child will be, you can
      Message 2 of 3 , Sep 5, 2006
      • 0 Attachment
        On Tue, Sep 05, 2006 at 11:45:20AM -0400, Bryce Fischer wrote:
        > Maybe I'm not understanding the Event.onAvailable method, but it seems
        > its firing before the entire contents are available.

        onAvailable fires when the element is accessible. This does not guarantee
        that its children are ready. If you know what the last child will be, you
        can try attaching the handler to that element.

        We do plan on enhancing onAvailable to better handle this use case.

        -Adam
      • Dave Viner
        I believe your suggestion implies that IE will load it s DOM tree serially (that is, the last child element is loaded/isAvailable only after all preceding
        Message 3 of 3 , Sep 12, 2006
        • 0 Attachment
          I believe your suggestion implies that IE will load it's DOM tree
          serially (that is, the last child element is loaded/isAvailable only
          after all preceding siblings are available)... is that how IE works?
          Is the only alternative to this suggestion using the window.onload
          event?

          dave

          On Sep 5, 2006, at 10:05 PM, Adam Moore wrote:

          > On Tue, Sep 05, 2006 at 11:45:20AM -0400, Bryce Fischer wrote:
          > > Maybe I'm not understanding the Event.onAvailable method, but it
          > seems
          > > its firing before the entire contents are available.
          >
          > onAvailable fires when the element is accessible. This does not
          > guarantee
          > that its children are ready. If you know what the last child will
          > be, you
          > can try attaching the handler to that element.
          >
          > We do plan on enhancing onAvailable to better handle this use case.
          >
          > -Adam
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.