1 //<script type="text/javascript">
3 * Slideshow - based on a prototype one..
8 Roo.onReady( function()
10 // use a dom selector to define slides..
11 var slides = Roo.DomQuery.select('.category-slide');
13 oMySlides = new Roo.ux.Slideshow({
20 * @class Roo.ux.Slideshow
23 Roo.ux.Slideshow = function(cfg ) {
26 this.numOfImages = this.slides.length;
27 if ( !this.numOfImages ) {
31 this.playButton = Roo.get(this.playButton);
32 this.pauseButton = Roo.get(this.pauseButton);
33 if ( this.autostart ) {
34 this.startSlideShow();
37 Roo.apply(Roo.ux.Slideshow.prototype, {
52 swapImage: function (x,y) {
53 $(this.slides[x]) && $(this.slides[x]).appear({ duration: this.duration });
54 $(this.slides[y]) && $(this.slides[y]).fade({duration: this.duration });
57 // the onload event handler that starts the fading.
58 startSlideShow: function () {
60 window.setInterval(function () {
61 _t.play() },this.wait);
62 this.playButton && this.playButton.hide();
63 this.pauseButton && this.pauseButton.appear({ duration: 0});
71 var imageShow, imageHide;
73 imageShow = this.iImageId+1;
74 imageHide = this.iImageId;
76 if (imageShow == this.numOfImages) {
77 this.swapImage(0,imageHide);
80 this.swapImage(imageShow,imageHide);
84 this.textIn = this.iImageId+1 + ' of ' + this.numOfImages;
89 clearInterval(this.play);
90 this.playButton && this.playButton.appear({ duration: 0});
91 this.pauseButton && this.pauseButton.hide();
95 clearInterval(this.play);
96 $(this.playButton).appear({ duration: 0});
97 $(this.pauseButton).hide();
99 var imageShow, imageHide;
101 imageShow = this.iImageId+1;
102 imageHide = this.iImageId;
104 if (imageShow == this.numOfImages) {
105 this.swapImage(0,imageHide);
108 this.swapImage(imageShow,imageHide);
112 this.updatecounter();
115 goPrevious: function () {
116 clearInterval(this.play);
117 $(this.playButton).appear({ duration: 0});
118 $(this.pauseButton).hide();
120 var imageShow, imageHide;
122 imageShow = this.iImageId-1;
123 imageHide = this.iImageId;
125 if (this.iImageId == 0) {
126 this.swapImage(this.numOfImages-1,imageHide);
127 this.iImageId = this.numOfImages-1;
129 //alert(NumOfImages-1 + ' and ' + imageHide + ' i=' + i)
132 this.swapImage(imageShow,imageHide);
135 //alert(imageShow + ' and ' + imageHide)
138 this.updatecounter();
141 updatecounter: function () {
142 var textIn = this.iImageId+1 + ' of ' + this.numOfImages;
143 $(this.counter) && ( $(this.counter).innerHTML = textIn );
144 if ( $(this.caption) && ( oNewCaption = $(this.slides[this.iImageId]).down('.image-caption') ) ) {
145 $(this.caption).innerHTML = oNewCaption.innerHTML;