PDA

View Full Version : Auto rotate Carousel?



Bucs
8 Feb 2011, 10:59 AM
Is there a standard way to hook up an auto-rotating carousel without have to write my own setTimeout JS code? Looking for best practice here.

Thanks!

gcallaghan
8 Feb 2011, 4:53 PM
Not sure if its best practices but this seems sencha centric... or "Senchric" if you will...



var MyAutoCarousel = new Ext.Carousel({
cardSwitchDelay = 3000;
autoNext:new Ext.util.DelayedTask(function(){
this.fireEvent('autoNextCard');
}),
listeners:{
autoNextCard:function(){
var next = this.layout.getNext();
next = next? next: this.items.get(0);
this.scrollToCard(next);
this.autoNext.delay(this.cardSwitchDelay);
},
startRotation:function(){
this.autoNext(this.cardSwitchDelay);
},
exitConditionEvent:function(){
this.autoNext.cancel();
},
activate:function(){
this.fireEvent('startRotation');
}
}
});


note* this is untested, just something I threw together in the reply form

headkit
29 Aug 2011, 7:40 AM
interested! any news here?

e-mike
17 Feb 2012, 1:14 AM
http://www.sencha.com/forum/showthread.php?150218-image-slide-show-with-carousel-in-sencha-touch-randomly&p=736309&viewfull=1#post736309