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