]>
git.wh0rd.org - tt-rss.git/blob - lib/position.js
1 /* http://textsnippets.com/posts/show/835 */
3 Position
.GetWindowSize = function(w
) {
5 var width
= w
.innerWidth
|| (w
.document
.documentElement
.clientWidth
|| w
.document
.body
.clientWidth
);
6 var height
= w
.innerHeight
|| (w
.document
.documentElement
.clientHeight
|| w
.document
.body
.clientHeight
);
10 /* http://textsnippets.com/posts/show/836 */
12 Position
.Center = function(element
, parent
) {
14 var d
= Element
.getDimensions(element
);
19 var ws
= Position
.GetWindowSize();
23 pw
= parent
.offsetWidth
;
24 ph
= parent
.offsetHeight
;
26 element
.style
.top
= (ph
/2) - (h/2) - Position
.deltaY
+ "px";
27 element
.style
.left
= (pw
/2) - (w/2) - Position
.deltaX
+ "px";