slick
slick copied to clipboard
Bug found. Snapping back to first slide on drag
As title says. Here's a codepen.
Grab the last visible slide (6) and drag it as far to the left as you can and release. Instead of showing the remaining slides, it snaps back to the first slide. Tested on Chrome and Safari, Mac and Windows.
Here's an animated GIF:
Try changing your margin to margin: 0 30px 0 0; and add the property : "swipeToSlide: true" to your slick initialisation. Seems to function a bit better, but still not perfect.
@Kehza Thanks but it makes no difference and swipeToSlide is already active. This is clearly a bug that needs fixing on a different level.
I think there should be an option to add margin between slides instead of relying on CSS.
wow, still nothing?
Can confirm, this is still happening. Unable to swipe to the left, always snaps back.
Same problem here
Something about this issue?
Same issue here, can't understand what's the problem...
The issue for me, is coming from Bootstrap 4, I just tried to use an old version (3.3.4) and it's working fine.
Problem was coming from the .row class, as long as I put the slider in a row tag, the swiping is not working properly, by putting it out from the row, it works just fine 👍
This also could help some of yours, add to your carousel the following CSS settings:
.slick-slider { min-width: 100%; width: 0; }
in my case
- i add dir="ltr" to my slider element,
- remove slidesToScroll because using swipeToslide
- add float:left !important; to .slick-slide NOT .-sclick-slidER also rtl:true is not working by swipeToslide (if in your html or body there is dir="rtl" and you like use rtl:true but this setting doent work by swipeToslide setting)
Any update?
Any update?
looks like bug still exists ;(
Getting rid of the previous and next buttons helped for me to get clean dragging: .slick-prev, .slick-next { display: none!important; }
I think this should help with smooth draggable feature. Its clearly mentioned in the docs.
To advance slides, the user must swipe a length of (1/touchThreshold) * the width of the slider
. As you see it totally depends upon the touchThreshould.
In my case set swipeToSlide: false fix the problem
In case of react-slick, I fix it using swipeEvent ( or onSwipe ). Maybe it can be applied to slick using on swipe in slick ( I didn't try it ).
First add sliderRef to Slider Object
const sliderRef = useRef<Slider | null>(null)
...
// at Slider component
<Slider ref={sliderRef}>
Second set currentSlide at SliderSetting
const [currentSlide, setCurrentSlide] = useState(0);
...
// at SliderSetting
beforeChange: (_prev, next) => {
setCurrentSlide(next);
}
Third at SliderSetting add code below.
// at SliderSetting
swipeEvent: (e) => {
e === "left"
? sliderRef.current.slickGoto(currentSlide + 1)
: sliderRef.current.slickGoto(currentSlide - 1)
}