Bug Tracker


Ticket #6326 (closed bug: invalid)

Opened 4 years ago

Last modified 4 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 4 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 4 years ago by dmethvin

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

Closed per your request.

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


Add a comment

Modify Ticket

as closed

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

Note: See TracTickets for help on using tickets.