Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/inner-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ export class InnerSlider extends React.Component {
};
checkImagesLoad = () => {
let images =
(this.list && this.list.querySelectorAll &&
(this.list &&
this.list.querySelectorAll &&
this.list.querySelectorAll(".slick-slide img")) ||
[];
let imagesCount = images.length,
Expand Down
21 changes: 15 additions & 6 deletions src/utils/innerSliderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export function clamp(number, lowerBound, upperBound) {

export const safePreventDefault = event => {
const passiveEvents = ["onTouchStart", "onTouchMove", "onWheel"];
if(!passiveEvents.includes(event._reactName)) {
if (!passiveEvents.includes(event._reactName)) {
event.preventDefault();
}
}
};

export const getOnDemandLazySlides = spec => {
let onDemandSlides = [];
Expand Down Expand Up @@ -297,7 +297,13 @@ export const changeSlide = (spec, options) => {
}
} else if (options.message === "dots") {
// Click on dots
targetSlide = options.index * options.slidesToScroll;
if (options.index === currentSlide) {
targetSlide = options.index;
} else if (slideCount === options.index + 1 && currentSlide === 0) {
targetSlide = -1;
} else {
targetSlide = options.index * options.slidesToScroll || slideCount;
}
} else if (options.message === "children") {
// Click on the slides
targetSlide = options.index;
Expand Down Expand Up @@ -386,9 +392,12 @@ export const swipeMove = (e, spec) => {
let touchSwipeLength = touchObject.swipeLength;
if (!infinite) {
if (
(currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down")) ||
(currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up")) ||
(!canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up"))
(currentSlide === 0 &&
(swipeDirection === "right" || swipeDirection === "down")) ||
(currentSlide + 1 >= dotCount &&
(swipeDirection === "left" || swipeDirection === "up")) ||
(!canGoNext(spec) &&
(swipeDirection === "left" || swipeDirection === "up"))
) {
touchSwipeLength = touchObject.swipeLength * edgeFriction;
if (edgeDragged === false && onEdge) {
Expand Down