the compact javascript framework
in partnership with mediatemple
Contains Element prototypes to deal with Element size and position in space.
The functions in this script require n XHTML doctype.
MIT-style license.
Element. Dimensions.js | Contains Element prototypes to deal with Element size and position in space. |
Element | Custom class to allow all of its methods to be used with any DOM element via the dollar function $. |
Properties | |
scrollTo | Scrolls the element to the specified coordinated (if the element has an overflow) |
getSize | Return an Object representing the size/scroll values of the element. |
getPosition | Returns the real offsets of the element. |
getTop | Returns the distance from the top of the window to the Element. |
getLeft | Returns the distance from the left of the window to the Element. |
getCoordinates | Returns an object with width, height, left, right, top, and bottom, representing the values of the Element |
Custom class to allow all of its methods to be used with any DOM element via the dollar function $.
Properties | |
scrollTo | Scrolls the element to the specified coordinated (if the element has an overflow) |
getSize | Return an Object representing the size/scroll values of the element. |
getPosition | Returns the real offsets of the element. |
getTop | Returns the distance from the top of the window to the Element. |
getLeft | Returns the distance from the left of the window to the Element. |
getCoordinates | Returns an object with width, height, left, right, top, and bottom, representing the values of the Element |
Scrolls the element to the specified coordinated (if the element has an overflow)
x | the x coordinate |
y | the y coordinate |
$('myElement').scrollTo(0, 100)
Return an Object representing the size/scroll values of the element.
$('myElement').getSize();
{ 'scroll': {'x': 100, 'y': 100}, 'size': {'x': 200, 'y': 400}, 'scrollSize': {'x': 300, 'y': 500} }
Returns the real offsets of the element.
overflown | optional, an array of nested scrolling containers for scroll offset calculation, use this if your element is inside any element containing scrollbars |
$('element').getPosition();
{x: 100, y:500};
Returns the distance from the top of the window to the Element.
overflown | optional, an array of nested scrolling containers, see Element::getPosition |
Returns the distance from the left of the window to the Element.
overflown | optional, an array of nested scrolling containers, see Element::getPosition |
Returns an object with width, height, left, right, top, and bottom, representing the values of the Element
overflown | optional, an array of nested scrolling containers, see Element::getPosition |
var myValues = $('myElement').getCoordinates();
{ width: 200, height: 300, left: 100, top: 50, right: 300, bottom: 350 }
returns the element passed in with all the Element prototypes applied.
Documentation by Aaron Newton & Mootools Developers, generated by NaturalDocs and GeSHi