Bug Tracker

Modify

Ticket #1160 (closed bug: wontfix)

Opened 6 years ago

Last modified 14 months ago

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:
Blocking: Blocked by:

Description (last modified by brandon) (diff)

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

comment:1 Changed 6 years ago by brandon

  • Status changed from new to closed
  • Resolution set to wontfix
  • Description modified (diff)

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.