Reference home > @af-utils/virtual-core > VirtualScroller > getIndex

VirtualScroller.getIndex() method

Get nearest item index for pixel offset;

Signature:

getIndex(offset: number): number;

Parameters

Parameter

Type

Description

offset

number

Pixel offset.

Returns

number

Nearest item index

Remarks

itemCount must be > 0. Possible item index range: 0 <= N < itemCount. Time complexity: O(log2(itemCount))