Author: pyaschenko
Date: 2008-03-27 12:33:48 -0400 (Thu, 27 Mar 2008)
New Revision: 7313
Modified:
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
http://jira.jboss.com/jira/browse/RF-2543
Modified:
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
---
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-03-27
16:32:18 UTC (rev 7312)
+++
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-03-27
16:33:48 UTC (rev 7313)
@@ -939,10 +939,27 @@
Element.setStyle(this.target, Object.extend({"left": pos[0] +
"px", "top": pos[1] + "px"}, targetStyle));
}
*/
+
var offsets = this.calcOffsets(this.source);
- Element.setStyle(this.target, Object.extend({"left":
offsets["x"]
- + "px", "top": offsets["y"] +
"px"}, targetStyle));
+ var offsetTop = 0;
+ var offsetLeft = 0;
+ if (RichFaces.navigatorType() != RichFaces.MSIE)
+ {
+ var els = this.target.style;
+ var originalVisibility = els.visibility;
+ var originalDisplay = els.display;
+ els.visibility = 'hidden';
+ els.display = '';
+ var offsetTop = this.target.offsetParent.scrollTop;
+ var offsetLeft = this.target.offsetParent.scrollLeft;
+ els.display = originalDisplay;
+ els.visibility = originalVisibility;
+ }
+
+ Element.setStyle(this.target, Object.extend({"left":
(offsets["x"]+offsetLeft)
+ + "px", "top": (offsets["y"]+offsetTop) +
"px"}, targetStyle));
+
if (options.iframeId) {
var iframe = $(options.iframeId);
Position.clone(this.target, iframe);
@@ -958,21 +975,8 @@
},
calcOffsets : function(element) {
- var ret = new Object(), height = 0;
- var left = element.offsetLeft;
- var top = element.offsetTop;
- var parent = element.offsetParent;
- while (parent)
- {
- left += parent.offsetLeft;
- top += parent.offsetTop;
- parent = parent.offsetParent;
- }
-
- ret["x"] = left;
- ret["y"] = top + element.offsetHeight;
-
- return ret;
+ var offsetBase = element.cumulativeOffset();
+ return {x: offsetBase[0], y: element.offsetHeight + offsetBase[1]};
},
_removePx : function(str) {