Bug Tracker

Ticket #8195 (closed bug: invalid)

Opened 4 years ago

Last modified 2 years ago

offset(coordinates) setter does not work properly with position:fixed div and Chrome/ Safari (fiddle inside)

Reported by: jfremy@… Owned by:
Priority: low Milestone: 1.next
Component: offset Version: 1.5
Keywords: Cc:
Blocking: Blocked by:

Description

Fiddle demonstrating the bug:  http://jsfiddle.net/jfremy/KG7x7/ Expected result: show the div at location 200,100. Written in white against a black background.

When setting the offset of a fixed position div under chrome / safari, the div is incorrectly positioned.

In jsfiddle, this happens with Jquery 1.4+ (works fine in Jquery 1.2 and 1.3).

I initially discovered the bug while using Jquery UI position but pinpointed it to jquery setOffset function.

It works fine with IE8 and FF3.6.

Change History

comment:1 Changed 4 years ago by jitter

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to offset

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!

After checking your report I came to the conclusion that this isn't a jQuery bug but rather an unfortunate use of CSS.

Just think about what you are doing. You first set bottom/right and later on specify top/left too. But the values are set in a manner that it's impossible for the browser to satisfy both constraints (top vs bottom and left vs right) at the same time. And thus you end up with unspecified behavior which differs across browsers.

So either refrain form using bottom/right and top/left at the same time or try something along the lines of  http://jsfiddle.net/jitter/KG7x7/15/ (resetting bottom/right and then setting top/left)

Version 0, edited 4 years ago by jitter (next)
Note: See TracTickets for help on using tickets.