Bug Tracker

Opened 13 years ago

Closed 13 years ago

Last modified 8 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.

Example:

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

Change History (1)

comment:1 Changed 13 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.