Excuse me,How can Carousel it be Loop Playback
-
Excuse me,How can Carousel it be Loop Playback React
-
Based on the following: https://onsen.io/v2/api/js/ons-carousel.html
Here you go! I adjusted the code based on the available methods and propeties of the ons-carousel.
var prev = function() { var carousel = document.getElementById('carousel'); if (carousel.getActiveIndex() === 0) carousel.last(); else carousel.prev(); }; var next = function() { var carousel = document.getElementById('carousel'); // alert(carousel.getActiveIndex()); if (carousel.getActiveIndex() === carousel.itemCount-1) carousel.first(); else carousel.next(); }; ons.ready(function() { var carousel = document.addEventListener('postchange', function(event) { console.log('Changed to ' + event.activeIndex) }); });
-

React carousel Bug?