Bug Tracker

Ticket #6326 (closed bug: invalid)

Opened 6 years ago

Last modified 6 years ago

offset(function(index, coords)) does not properly pass index

Reported by: scott_sauyet Owned by:
Priority: Milestone: 1.4.3
Component: offset Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:


When offset() is used as a setter, passed a function, it's supposed to pass the index of the current element in the JQ collection as the first parameter to that function. But it seems to always pass 0.

In this code:

$('div').each(function() {

$(this).offset(function(index, coord) {

$(this).append($("<p>index:" + index + "<\/p>"));



each DIV has appended: "<p>index: 0</p>"

There is a test case at  http://scott.sauyet.com/Javascript/Demo/2010-03-19a/ and the discussion which lead to the discovery at  http://forum.jquery.com/topic/offset-index-coord .

Change History

comment:1 Changed 6 years ago by scott_sauyet

Oops, never mind. A later post in the thread showed what was wrong in that code. (Now why was that ".each" there in the first place? :-( )

Sorry. I don't seem to have authorization to cancel this myself...

comment:2 Changed 6 years ago by dmethvin

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

Closed per your request.

Note: See TracTickets for help on using tickets.