Side navigation
#905 closed bug (fixed)
Opened February 01, 2007 10:53AM UTC
Closed February 10, 2007 10:34AM UTC
getPosition function in iutils.js (interface) fails for in-line elements in Opera
Reported by: | pragueexpat@hotmail. | Owned by: | stefan |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | interface | Version: | |
Keywords: | getPosition Opera inline | Cc: | |
Blocked by: | Blocking: |
Description
Trying to use the ScrollTo function, I found that it wouldn't work in Opera. After some debugging, I realized that if the anchor (element I wanted to scroll to) was an inline element, it would fail. Block elements work fine. I posted this in the discussion forum:
http://www.nabble.com/Scrolling-in-Opera--tf3138253.html
and Brandon Aaron responded that he just fixed the same problem in dimensions.js:
http://www.nabble.com/forum/ViewPost.jtp?post=8714601&framed=y
The code that Brandon included in dimensions.js is near the bottom of the page:
// Opera thinks offset is scroll offset for display: inline elements if (options.scroll && jQuery.browser.opera && jQuery.css(elem, 'display') == 'inline') { sl -= elem.scrollLeft || 0; st -= elem.scrollTop || 0; }
This duplication of code (same functionality in iutils.js and dimensions.js) should be eliminated, if possible, in order to keep jQuery as simple as possible.
Attachments (0)
Change History (3)
Changed February 01, 2007 02:39PM UTC by comment:1
description: | Trying to use the ScrollTo function, I found that it wouldn't work in Opera. After some debugging, I realized that if the anchor (element I wanted to scroll to) was an inline element, it would fail. Block elements work fine. I posted this in the discussion forum:\ \ http://www.nabble.com/Scrolling-in-Opera--tf3138253.html\ \ and Brandon Aaron responded that he just fixed the same problem in dimensions.js:\ \ http://www.nabble.com/forum/ViewPost.jtp?post=8714601&framed=y\ \ The code that Brandon included in dimensions.js is near the bottom of the page:\ \ // Opera thinks offset is scroll offset for display: inline elements\ if (options.scroll && jQuery.browser.opera && jQuery.css(elem, 'display') == 'inline') {\ sl -= elem.scrollLeft || 0;\ st -= elem.scrollTop || 0;\ }\ \ \ This duplication of code (same functionality in iutils.js and dimensions.js) should be eliminated, if possible, in order to keep jQuery as simple as possible.\ → Trying to use the ScrollTo function, I found that it wouldn't work in Opera. After some debugging, I realized that if the anchor (element I wanted to scroll to) was an inline element, it would fail. Block elements work fine. I posted this in the discussion forum:\ \ http://www.nabble.com/Scrolling-in-Opera--tf3138253.html\ \ and Brandon Aaron responded that he just fixed the same problem in dimensions.js:\ \ http://www.nabble.com/forum/ViewPost.jtp?post=8714601&framed=y\ \ The code that Brandon included in dimensions.js is near the bottom of the page:\ \ {{{\ // Opera thinks offset is scroll offset for display: inline elements\ if (options.scroll && jQuery.browser.opera && jQuery.css(elem, 'display') == 'inline') {\ sl -= elem.scrollLeft || 0;\ st -= elem.scrollTop || 0;\ }\ }}}\ \ This duplication of code (same functionality in iutils.js and dimensions.js) should be eliminated, if possible, in order to keep jQuery as simple as possible.\ |
---|
Changed February 05, 2007 04:12AM UTC by comment:2
Changed February 10, 2007 10:34AM UTC by comment:3
resolution: | → fixed |
---|---|
status: | new → closed |
i used following code (note added if)
[code]
if(!jQuery.browser.opera && jQuery(e).css('display') != 'absolute')
while (el && el.tagName.toLowerCase() != 'body')
{
x -= el.scrollLeft||0;
y -= el.scrollTop||0;
el = el.parentNode;
}
/code