i was wondering if there is any way to get the current slide index?
Try this solutions:
on component create method for example
nextClick: function(e){
//alert('next');
console.log(e);
}
on render function I added like this
render: function() {
.....
var settings = {
dots: false,
infinite: true,
speed: 500,
swipeToSlide: false,
arrows: true,
slidesToShow: 2,
afterChange: this.nextClick,
slidesToScroll: 2
};
return (
}
And I got on console 2 4 6 8 10 (Because I show 2 slider Item in one time
And you can keep from "e" variable current Slider Item
I hope it's help you
use afterChange method, it allows to get currentSlide index as callback function's parameter
afterChangeHandler(currentSlide) {
this.props.updateInitialSlide(currentSlide);
}
<Slider {...settings} afterChange={this.afterChangeHandler}>
Most helpful comment
Try this solutions:
on component create method for example
nextClick: function(e){
//alert('next');
console.log(e);
}
on render function I added like this
render: function() {
.....
var settings = {
dots: false,
infinite: true,
speed: 500,
swipeToSlide: false,
arrows: true,
slidesToShow: 2,
afterChange: this.nextClick,
slidesToScroll: 2
};
return ( )
}
And I got on console 2 4 6 8 10 (Because I show 2 slider Item in one time
And you can keep from "e" variable current Slider Item
I hope it's help you