Skip to main content

Bug Tracker

Side navigation

#6326 closed bug (invalid)

Opened March 20, 2010 07:02PM UTC

Closed March 20, 2010 11:57PM UTC

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 .

Attachments (0)
Change History (2)

Changed March 20, 2010 10:20PM UTC by scott_sauyet comment:1

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...

Changed March 20, 2010 11:57PM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed

Closed per your request.