Bug Tracker

Opened 16 years ago

Closed 16 years ago

#905 closed bug (fixed)

getPosition function in iutils.js (interface) fails for in-line elements in Opera

Reported by: [email protected] Owned by: stefan
Priority: major Milestone:
Component: interface Version:
Keywords: getPosition Opera inline Cc:
Blocked by: Blocking:

Description (last modified by joern)

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.

Change History (3)

comment:1 Changed 16 years ago by joern

Description: modified (diff)

comment:2 Changed 16 years ago by anonymous

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.scrollLefty -= el.scrollTop
0;
0;

el = el.parentNode;

}

code

comment:3 Changed 16 years ago by stefan

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.