这样? function getRangeIndex() { var i=0; for (;i<ranges.length;i++) if (scrollTop<ranges[i]) break; return i-1; }
这样?