简体   繁体   中英

Zurb Foundation Orbit Slider Pause on 3rd Slide

I added animation speeds, and can pause on hover; however, I was curious if with JS I am able to pause on a certain slide, or at least a certain time. Any suggestions how this might be possible?

thanks!

The orbit js dispatches events when the slide changes 'orbit.next' 'orbit.prev'...

  //from the orbit js
  this.$element.bind('orbit.next', function () {
    self.shift('next');
  });

  this.$element.bind('orbit.prev', function () {
    self.shift('prev');
  });

you can listen to these events with jQuery, eg.

$("#featured").bind('orbit.next orbit.prev', function(event){
      console.log('slide change', event);
  });

Not sure how you would get the time, but you could alter the orbit js to expose the info you need.

To get the slide number you could enable the 'slideNumber' option

slideNumber: true,               // display slide numbers?

and get the number from the display.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM