Women in Technology

Hear us Roar



Article:
  Writing Advanced JavaScript
Subject:   popup menu javascript
Date:   2007-10-22 13:12:15
From:   mooniss
Thanks, Howard. I found the popup menu code very useful. I use javascript to prototype UI for user testing and proof of concept. As such, snippets like these are ideal. I will probably delve into extjs (http://www.extjs.com) soon and get acquainted with a javascript library.


I comprehend everything in your example except the while loop in the getElementAbsPos functions. Is this to avoid an element nested within a relative positioned parentNode? Thanks again.

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • popup menu javascript
    2007-10-22 17:44:17  drfinesse [View]

    Basically, yes. As mentioned in the text, each node stores the relative position to its parent in this field, so you must traverse all the way up to the root to get the correct total. Note some browsers have easier ways of getting this info (by looking in different places), but this method is reliable and works on ALL modern browsers.