Hi
I'm trying to achieve something like this codepen example.
But with the new Glide version there is no way to get the current slide.
How can i get this to work?
afterTransition: function (event) {
coverflow(event.index, event.current);
console.log(event.index);
console.log(event.current);
}
full code would look like:
function coverflow(i, el) {
el.removeClass('pre following')
.nextAll()
.removeClass('pre following')
.addClass('following')
.end()
.prevAll()
.removeClass('pre following')
.addClass('pre');
}
$('#Glide').glide({
type: 'slider',
startAt: 3,
animationDuration: 500,
paddings: '25%',
afterInit: function (event) {
coverflow(event.index, event.current);
},
afterTransition: function (event) {
coverflow(event.index, event.current);
console.log(event.index);
}
});
afterInit and afterTransition does not work with glide v3.2.3
For me (version 3.2.3), this works:
let cookbook = new Glide('.glide');
cookbook.on('move', function(e,f) {
console.log(cookbook.index);
});
cookbook.mount();
You can access current index numer with index property on specific glide instance.
var glide = new Glide('.glide');
console.log(glide.index);
Most helpful comment
You can access current index numer with
indexproperty on specific glide instance.