Bug Tracker

Opened 16 years ago

Closed 16 years ago

Last modified 11 years ago

#1160 closed bug (wontfix)

Dimensions: <body> with margin auto results in bogus values from offset() on IE

Reported by: mikeker Owned by:
Priority: minor Milestone: 1.1.3
Component: plugin Version: 1.1.2
Keywords: dimensions Cc:
Blocked by: Blocking:

Description (last modified by brandon)

Using the Dimensions plugin (v 1.0a) and jQuery (v1.1.2). On IE (6 or 7), offset() doesn't take into account the margin on the <body> tag when margin: auto is specified. Works as expected on FF2. Workaround is to insert wrapper div just inside the <body> tags and put your <body> styling there.


<script type='text/javascript'>
	$( document ).ready( function () {
		alert( $( '#test' ).offset().left );
<body style='width: 600px; margin: auto;'>
		Lorem ipsum dolor sit amet, <a id='test' href='#'>massa</a> elit facilisis, enim sociis lacinia in dui fusce quam etc.etc.etc.

Change History (1)

comment:1 Changed 16 years ago by brandon

Description: modified (diff)
Resolution: wontfix
Status: newclosed

Margins, borders and padding must be specified in pixel values for the calculations to be correct in IE. Unfortunately fixing IE in this manner would bring offset to a screeching halt in performance.

Note: See TracTickets for help on using tickets.