javascript - How to get the current slide no in Glide.js -


hi how can current slide no when click next , previous button in glide.js http://glide.jedrzejchalubek.com/docs.html#intro.

var carousel = $('#carousel').glide({                 type: 'carousel',                 startat: 1,                 touchdistance: 2,           afterinit:function(){console.log("paintslider")},           autoplay: 0               }); console.log(carousel.current()); 

for reason, function carousel.current() not working.

you can use code's callback , events instead. example:

var carousel = $('#carousel').glide({             type: 'carousel',             ...             aftertransition : function(event) {                 console.log(event.index); // current slide number             }          }); 

also, carousel.index() works too!


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -