class method Element.measure
Element.measure(element, property) → Number
Gives the pixel value of element
's dimension specified by
property
.
Useful for one-off measurements of elements. If you find yourself
calling this method frequently over short spans of code, you might want
to call Element.getLayout
and operate on the Element.Layout
object itself (thereby taking advantage of measurement caching).
Examples
$('troz').measure('width'); //-> 150 $('troz').measure('border-top'); //-> 5 $('troz').measure('top'); //-> 226
Caveats
Element.measure
can measure the dimensions of an element hidden with CSS (display: none
), but only if its parent element is visible.
This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.