WebSlides icon indicating copy to clipboard operation
WebSlides copied to clipboard

How to get 'ws:slide-change'

Open zphering opened this issue 4 years ago • 4 comments

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!

zphering avatar Jan 15 '21 11:01 zphering

No answer ? I'm looking for a way to make a progress bar with number slide and total slides on slide change.

this-user-name avatar Dec 12 '21 10:12 this-user-name

I'm also searching for the miracle events but don't know from where to get them.

scaraliu avatar Aug 27 '22 19:08 scaraliu

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 

bmpf avatar Aug 27 '22 21:08 bmpf

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.

scaraliu avatar Aug 28 '22 10:08 scaraliu