scrollable提供的一系列获取scrollable对象的方法具体使用方式如下:
方法名称
|
Return value | Description |
getConf() | Object | returns the configuration object of scrollable, and the properties of the configuration object can be modified by setting the relevant property values of the object. |
getIndex() | number | Get the index number of the current scroll item, 0 represents the first element, 1 represents the second element, and so on. In addition, it should be noted that if multiple scroll items are obtained, only the index number of the first scroll item will be returned. |
getItems() | jQuery | Returns all scroll items, and the results are returned as jquery objects. |
getItemWrap() | jQuery | Get the parent node of the scroll item, and the result is returned as a jquery object. |
getPageAmount() | number | Get the number of pages of the current scroll bar. |
getPageIndex() | number | Returns the current paging index number. For example, if paging is set to 5 scroll items/page, and the current scroll item position is 7, then 1 (second page) will be returned |
getRoot() | jQuery | Get the upper-level node of the scroll item. |
getSize() | number | Returns the number of scroll items. This method is equivalent to getConf().size |
getVisibleItems() | jQuery | Gets a list of currently visible scroll items. The list is a jquery object. The number of visible scroll items is defined by the size attribute of the configuration object. |
reload() | API | scrollable supports the function of dynamically adding and removing scroll items. After dynamically adding or removing scroll items, call this method to automatically update information about paging navigation and scroll item movement. |
prev() | API | Jump to the previous item of this scroll item (if this scroll item is not the first scroll item) |
next() | API | Jump to the next item of this scroll item (if this scroll item is not the last scroll item) |
seekTo(index) | API | Jump to the scroll item at the specified index. |
move(offset) | API | Move the position of the scroll item in the current state (activated) forward/backward by the offset of the current scroll item. If Offset is positive, the scroll item moves to the right/down, otherwise, it moves to the left/up. For example: move(2), the index of the scroll item in the current state is transferred from the i scroll item to the i 2 scroll item. |
prevPage() | API | Jump to the previous page (if it is not the first page). |
nextPage() | API | Jump to the next page (if it is not the last page). |
setPage(index) | API | Jump to page index. For example, index=2, then it will jump from the current page to page 3. |
movePage(offset) | API | is used to switch the position of the displayed page from the current page to this page/the next offset page. Other explanations of this method are similar to (offset). |
begin() | API | Jump to the first scroll item, equivalent to seekTo(0). |
end() | API | Jump to the last scroll item. |
click(index) | API | makes the index scroll item selected (activated). |
onBeforeSeek(fn) | API | 参见配置对象的onBeforeSeek相关说明 |
onSeek(fn) | API | 参见配置对象的onSeek相关说明 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin et felis eget
tellus pharetra porttitor. Praesent dui arcu, egestas quis, adipiscing a.