4 * Author: Stefan Petre www.eyecon.ro
9 getPosition : function(e
, forceIt
)
14 var restoreStyles
= false;
15 if (forceIt
&& jQuery
.curCSS(e
,'display') == 'none') {
16 var oldVisibility
= es
.visibility
;
17 var oldPosition
= es
.position
;
19 es
.visibility
= 'hidden';
21 es
.position
= 'absolute';
24 if (el
.getBoundingClientRect
) { // IE
25 var box
= el
.getBoundingClientRect();
26 x
= box
.left
+ Math
.max(document
.documentElement
.scrollLeft
, document
.body
.scrollLeft
) - 2;
27 y
= box
.top
+ Math
.max(document
.documentElement
.scrollTop
, document
.body
.scrollTop
) - 2;
39 if (jQuery
.browser
.safari
&& jQuery
.curCSS(e
, 'position') == 'absolute' ) {
40 x
-= document
.body
.offsetLeft
;
41 y
-= document
.body
.offsetTop
;
44 while (el
&& el
.tagName
.toUpperCase() != 'BODY' && el
.tagName
.toUpperCase() != 'HTML')
46 if (jQuery
.curCSS(el
, 'display') != 'inline') {
53 if (restoreStyles
== true) {
55 es
.position
= oldPosition
;
56 es
.visibility
= oldVisibility
;
62 var w
= parseInt(jQuery
.curCSS(e
,'width'), 10);
63 var h
= parseInt(jQuery
.curCSS(e
,'height'), 10);
66 if (jQuery
.curCSS(e
, 'display') != 'none') {
71 var oldVisibility
= es
.visibility
;
72 var oldPosition
= es
.position
;
73 es
.visibility
= 'hidden';
75 es
.position
= 'absolute';
79 es
.position
= oldPosition
;
80 es
.visibility
= oldVisibility
;
82 return {w
:w
, h
:h
, wb
:wb
, hb
:hb
};
84 getClient : function(e
)
91 var de
= document
.documentElement
;
92 w
= window
.innerWidth
|| self
.innerWidth
|| (de
&&de
.clientWidth
) || document
.body
.clientWidth
;
93 h
= window
.innerHeight
|| self
.innerHeight
|| (de
&&de
.clientHeight
) || document
.body
.clientHeight
;
97 getScroll : function (e
)
99 var t
=0, l
=0, w
=0, h
=0, iw
=0, ih
=0;
100 if (e
&& e
.nodeName
.toLowerCase() != 'body') {
106 if (document
.documentElement
) {
107 t
= document
.documentElement
.scrollTop
;
108 l
= document
.documentElement
.scrollLeft
;
109 w
= document
.documentElement
.scrollWidth
;
110 h
= document
.documentElement
.scrollHeight
;
111 } else if (document
.body
) {
112 t
= document
.body
.scrollTop
;
113 l
= document
.body
.scrollLeft
;
114 w
= document
.body
.scrollWidth
;
115 h
= document
.body
.scrollHeight
;
117 if (typeof pageYOffset
!= 'undefined') {
121 iw
= self
.innerWidth
||document
.documentElement
.clientWidth
||document
.body
.clientWidth
||0;
122 ih
= self
.innerHeight
||document
.documentElement
.clientHeight
||document
.body
.clientHeight
||0;
124 return { t
: t
, l
: l
, w
: w
, h
: h
, iw
: iw
, ih
: ih
};
126 getMargins : function(e
, toInteger
)
128 var t
= jQuery
.curCSS(e
,'marginTop') || '';
129 var r
= jQuery
.curCSS(e
,'marginRight') || '';
130 var b
= jQuery
.curCSS(e
,'marginBottom') || '';
131 var l
= jQuery
.curCSS(e
,'marginLeft') || '';
134 t
: parseInt(t
, 10)||0,
135 r
: parseInt(r
, 10)||0,
136 b
: parseInt(b
, 10)||0,
140 return {t
: t
, r
: r
, b
: b
, l
: l
};
142 getPadding : function(e
, toInteger
)
144 var t
= jQuery
.curCSS(e
,'paddingTop') || '';
145 var r
= jQuery
.curCSS(e
,'paddingRight') || '';
146 var b
= jQuery
.curCSS(e
,'paddingBottom') || '';
147 var l
= jQuery
.curCSS(e
,'paddingLeft') || '';
150 t
: parseInt(t
, 10)||0,
151 r
: parseInt(r
, 10)||0,
152 b
: parseInt(b
, 10)||0,
156 return {t
: t
, r
: r
, b
: b
, l
: l
};
158 getBorder : function(e
, toInteger
)
160 var t
= jQuery
.curCSS(e
,'borderTopWidth') || '';
161 var r
= jQuery
.curCSS(e
,'borderRightWidth') || '';
162 var b
= jQuery
.curCSS(e
,'borderBottomWidth') || '';
163 var l
= jQuery
.curCSS(e
,'borderLeftWidth') || '';
166 t
: parseInt(t
, 10)||0,
167 r
: parseInt(r
, 10)||0,
168 b
: parseInt(b
, 10)||0,
169 l
: parseInt(l
, 10)||0
172 return {t
: t
, r
: r
, b
: b
, l
: l
};
174 traverseDOM : function(nodeEl
, func
)
177 nodeEl
= nodeEl
.firstChild
;
179 EYE
.traverseDOM(nodeEl
, func
);
180 nodeEl
= nodeEl
.nextSibling
;
183 getInnerWidth : function(el
, scroll
) {
184 var offsetW
= el
.offsetWidth
;
185 return scroll
? Math
.max(el
.scrollWidth
,offsetW
) - offsetW
+ el
.clientWidth
:el
.clientWidth
;
187 getInnerHeight : function(el
, scroll
) {
188 var offsetH
= el
.offsetHeight
;
189 return scroll
? Math
.max(el
.scrollHeight
,offsetH
) - offsetH
+ el
.clientHeight
:el
.clientHeight
;
191 getExtraWidth : function(el
) {
193 return (parseInt($.curCSS(el
, 'paddingLeft'))||0)
194 + (parseInt($.curCSS(el
, 'paddingRight'))||0)
195 + (parseInt($.curCSS(el
, 'borderLeftWidth'))||0)
196 + (parseInt($.curCSS(el
, 'borderRightWidth'))||0);
199 getExtraHeight : function(el
) {
201 return (parseInt($.curCSS(el
, 'paddingTop'))||0)
202 + (parseInt($.curCSS(el
, 'paddingBottom'))||0)
203 + (parseInt($.curCSS(el
, 'borderTopWidth'))||0)
204 + (parseInt($.curCSS(el
, 'borderBottomWidth'))||0);
207 isChildOf: function(parentEl
, el
, container
) {
208 if (parentEl
== el
) {
211 if (!el
|| !el
.nodeType
|| el
.nodeType
!= 1) {
214 if (parentEl
.contains
&& !$.browser
.safari
) {
215 return parentEl
.contains(el
);
217 if ( parentEl
.compareDocumentPosition
) {
218 return !!(parentEl
.compareDocumentPosition(el
) & 16);
220 var prEl
= el
.parentNode
;
221 while(prEl
&& prEl
!= container
) {
222 if (prEl
== parentEl
)
224 prEl
= prEl
.parentNode
;
228 centerEl : function(el
, axis
)
230 var clientScroll
= EYE
.getScroll();
231 var size
= EYE
.getSize(el
);
232 if (!axis
|| axis
== 'vertically')
235 top
: clientScroll
.t
+ ((Math
.min(clientScroll
.h
,clientScroll
.ih
) - size
.hb
)/2) + 'px'
238 if (!axis
|| axis
== 'horizontally')
241 left
: clientScroll
.l
+ ((Math
.min(clientScroll
.w
,clientScroll
.iw
) - size
.wb
)/2) + 'px'
246 if (!$.easing
.easeout
) {
247 $.easing
.easeout = function(p
, n
, firstNum
, delta
, duration
) {
248 return -delta
* ((n
=n
/duration
-1)*n
*n
*n
- 1) + firstNum
;