Bug Tracker

Opened 13 years ago

Closed 13 years ago

#6326 closed bug (invalid)

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

Description

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 (2)

comment:1 Changed 13 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 13 years ago by dmethvin

Resolution: invalid
Status: newclosed

Closed per your request.

Note: See TracTickets for help on using tickets.