jquery帮助理解特定变量的代码如下

jquery帮助理解特定变量的代码如下,jquery,syntax,Jquery,Syntax,我从一个实用的教程中提取这段代码。。。我不明白索引从哪里来 $('.thumbnail_container a.thumbnail').each(function(index) { var remainder = (index%max_C)/100; var maxIndex = 0; /* debug */ $('.debug-remainder').append(remainder+'-'); if(remainder == 0) {

我从一个实用的教程中提取这段代码。。。我不明白
索引
从哪里来

$('.thumbnail_container a.thumbnail').each(function(index) {

    var remainder = (index%max_C)/100;
    var maxIndex = 0;
    /* debug */ $('.debug-remainder').append(remainder+'-');    

    if(remainder == 0) {
        if(index !=0) {
            thumbnail_R += thumbnailHeight;
        }
        thumbnail_C = 0;
    } else {
        thumbnail_C += thumbnailWidth;
    }

});

索引
是传递到
的第一个参数。默认情况下,each()
根据jQuery:

。each()文档:


您可以向该函数传递两个参数。Index是匹配元素列表中当前项的索引,valueOfElement是迭代中当前元素的值。

您的
的第一个参数。each()
回调函数是循环当前迭代的
索引(从0开始)

演示
-->


您是否查阅了jQuery
.each()
方法的文档??oops。。。对我现在明白了。。我第一次使用jQuery,所以现在有了学习更多的地方。。谢谢