@momo-kits/carousel 0.0.65-alpha.13 → 0.0.65-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CarouselV2.js +14 -0
- package/package.json +1 -1
package/CarouselV2.js
CHANGED
|
@@ -1030,6 +1030,20 @@ export default class Carousel extends React.PureComponent {
|
|
|
1030
1030
|
this.pauseAutoPlay();
|
|
1031
1031
|
}
|
|
1032
1032
|
|
|
1033
|
+
snapToItem(index, animated = true, fireCallback = true) {
|
|
1034
|
+
if (!index || index < 0) {
|
|
1035
|
+
index = 0;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
const positionIndex = this._getPositionIndex(index);
|
|
1039
|
+
|
|
1040
|
+
if (positionIndex === this._activeItem) {
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
this._snapToItem(positionIndex, animated, fireCallback);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1033
1047
|
snapToNext(animated = true, fireCallback = true) {
|
|
1034
1048
|
const itemsLength = this._getCustomDataLength();
|
|
1035
1049
|
|