Bug Tracker

Modify

Ticket #3584 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

css('top',0) causes incorrect positioning in IE6

Reported by: TNT Owned by: brandon
Priority: major Milestone: 1.3
Component: offset Version: 1.2.6
Keywords: Cc:
Blocking: Blocked by:

Description

try this code:

$('#div4').css({

'border':'1px solid red', 'position':'absolute', 'top':'0'

});

then i try: offs4=$('#div4').offset(); alert(offs4.top); -> this show me 2 not 0

Attachments

index.htm Download (1.0 KB) - added by TNT 5 years ago.
test html file

Change History

comment:1 Changed 5 years ago by TNT

actualy i try this:

nDiv=$('#div3').clone();

$(nDiv).appendTo(document.body);

$(nDiv).attr("id","div4");

$(nDiv).css({'width': 10, 'height': 10, 'border': '1px solid red', 'position': 'absolute', 'top': '0px', 'left': '0px'});

offs4=$('#div4').offset();

alert(offs4.top);

-> the DIV is corectly positioned but this show me 2 instead of 0 in IE6,in FF show me correct value of 0

comment:2 Changed 5 years ago by flesler

Indeed, you need to use '0px' or 0. I really can't tell about the second issue.

Can you make a test case ? (html file please)

Changed 5 years ago by TNT

test html file

comment:3 Changed 5 years ago by TNT

I'm added test html attachment file

comment:4 Changed 5 years ago by brandon

  • Status changed from new to closed
  • Resolution set to fixed

The core of your issue is that you are in QuriksMode because you do not have a valid DocType. You can fix this by either using a valid DocType or by setting html { border: 0; } in your css.

This is now fixed in rev 5942.

comment:5 Changed 5 years ago by flesler

  • Status changed from closed to reopened
  • Resolution fixed deleted

It's not fixed Brandon, just invalid.

comment:6 Changed 5 years ago by flesler

  • Status changed from reopened to closed
  • Resolution set to invalid

comment:7 Changed 5 years ago by flesler

  • Status changed from closed to reopened
  • Resolution invalid deleted

Awww... skipped the last line. I'm really really sorry.

comment:8 Changed 5 years ago by flesler

  • Status changed from reopened to closed
  • Resolution set to fixed

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.