some helper methods
This commit is contained in:
parent
d1ba11811d
commit
08f14e321f
1 changed files with 28 additions and 1 deletions
29
lib.js
29
lib.js
|
|
@ -45,4 +45,31 @@ inherits = function (ctor, superCtor) {
|
||||||
ctor.super_ = superCtor.prototype;
|
ctor.super_ = superCtor.prototype;
|
||||||
ctor.prototype = new tempCtor();
|
ctor.prototype = new tempCtor();
|
||||||
ctor.prototype.constructor = ctor;
|
ctor.prototype.constructor = ctor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getInnerWidth = function(element)
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
parseInt(computedStyle(element, "paddingLeft")) +
|
||||||
|
parseInt(computedStyle(element, "paddingRight")) +
|
||||||
|
element.clientWidth
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
getInnerHeight = function(element)
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
parseInt(computedStyle(element, "paddingTop")) +
|
||||||
|
parseInt(computedStyle(element, "paddingBottom")) +
|
||||||
|
element.clientHeight
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
computedStyle = function(element, style)
|
||||||
|
{
|
||||||
|
if (window.getComputedStyle) {
|
||||||
|
return (window.getComputedStyle(element, null))[style];
|
||||||
|
} else {
|
||||||
|
return element.currentStyle[style];
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue