Ajax Bestiary: A Javascript Field Guide
 
Ajax Bestiary: A Javascript Field Guide
 
 

Handling Space in Mootools

Posted by Don Albrecht

Today we continue our series exploring the way spacial data is handled in Javascript toolkits with a look at mootools.  (Read Previous Installments on jQuery and prototype).   Similar to prototype, mootools includes dimensioning information in the Element Object.  Unlike prototype, mootools includes positioning information there as well.  Window & Document level information is contained separately in Window.size.js

Element Dimension & Position Properties (Element.Dimensions.js):

  •  scrollTo(): Scrolls an element to a specified position (in some toolkits, scroll to scrolls the container to the specified element).
  • getSize(): Returns an Object representing all size & scroll values of the elemen.
  • getPosition(): Returns the real offsets of the element (relative to document).
  • getTop: Returns the top position of the element (relative to the window).
  • getLeft: Returns the left position of the element (relative to the window).

The Window dimensions (Window.Size.js):

  • getWidth: Returns width Window
  • getScrollWidth: Returns width of Document
  • getHeight: Returns height of Window
  • getScrollHeight: Returns height of Document
  • getScrollLeft: Determine current left offset of viewport relative to document.
  • getScrollTop: Determine current vertical offset of viewport relative to document.
  • getSize: Same as Element.getSize.

Next time, we’ll look at YUI.


Leave a Reply