WebSlides
WebSlides copied to clipboard
How to get 'ws:slide-change'
I tried to get the slide-change-event. Nothing happends. What goes wrong?
window.ws = new WebSlides({
autoslide: <?php echo $config['sildeTime']*1000; ?>,
loop: true,
changeOnClick: true,
showIndex: false,
});
document.addEventListener('ws:slide-change', function (e) {
console.log(e);
});
Thanks for your help!
No answer ? I'm looking for a way to make a progress bar with number slide and total slides on slide change.
I'm also searching for the miracle events but don't know from where to get them.
I was able to do it, like so :
window.ws = new WebSlides({});
if ( ws.initialised === true ) {
window.ws.el.addEventListener('ws:slide-change', function (e) {
callthisfunctiononchange() // call the function on change
});
}
if (ws.currentSlideI_ === 22) {} // for example check if slide is number 22
I was able to do it, like so :
window.ws = new WebSlides({}); if ( ws.initialised === true ) { window.ws.el.addEventListener('ws:slide-change', function (e) { callthisfunctiononchange() // call the function on change }); } if (ws.currentSlideI_ === 22) {} // for example check if slide is number 22
yes! Thx for the help. the issue was that new Webslides was done on a ws object not as a window.ws. Or something like that.