测试一篇文章看看

来源:互联网 发布:盘古网络的复式好过吗 编辑:程序博客网 时间:2024/05/03 22:00
var SimpleSlideShowDemo = new Class({options: {slides: [],startIndex: 0,wrap: true,onShow: Class.empty},initialize: function(options){this.setOptions(options);this.slides = [];this.effects = [];this.addSlides(this.options.slides);if(this.slides.length) {this.showSlide(this.options.startIndex);}},addSlides: function(slides){$(slides).each(function(slide){                        this.slides.include($(slide));                        this.effects[this.slides.indexOf(slide)] = new Fx.Style(slide, 'opacity');                        slide.addEvent('click', this.cycleForward.bind(this));              }, this);},addSlide: function(slide){this.addSlides([slide]);},cycleForward: function(){if($chk(this.now) && this.now<this.slides.length-1){this.showSlide(this.now+1);}else if(this.now&&this.options.wrap){this.showSlide(0);}else if(!$defined(this.now)){this.showSlide(this.options.startIndex);}},cycleBack:function(){if(this.now>0){this.showSlide(this.now-1);}else if(this.options.wrap){this.showSlide(this.slides.length-1);}},showSlide: function(iToShow){var now = this.now;var currentSlide = this.slides[now];var slide = this.slides[iToShow];//closurefunction fadeIn(s){s.setStyles({display:'block',visibility:'visible',opacity: 0});this.effects[this.slides.indexOf(s)].start(1);//from 0 to 1this.fireEvent('onShow',[slide,iToShow]);};if(slide) {if($chk(now) && now != iToShow){this.effects[now].start(0).chain(function(){this.slides[now].setStyle('display','none');fadeIn.apply(this, [slide]);}.bind(this));}else {fadeIn.apply(this,[slide]);}this.now = iToShow;}},});
var SimpleSlideShowDemo = new Class({options: {slides: [],startIndex: 0,wrap: true,onShow: Class.empty},initialize: function(options){this.setOptions(options);this.slides = [];this.effects = [];this.addSlides(this.options.slides);if(this.slides.length) {this.showSlide(this.options.startIndex);}},addSlides: function(slides){$(slides).each(function(slide){                        this.slides.include($(slide));                        this.effects[this.slides.indexOf(slide)] = new Fx.Style(slide, 'opacity');                        slide.addEvent('click', this.cycleForward.bind(this));              }, this);},addSlide: function(slide){this.addSlides([slide]);},cycleForward: function(){if($chk(this.now) && this.now<this.slides.length-1){this.showSlide(this.now+1);}else if(this.now&&this.options.wrap){this.showSlide(0);}else if(!$defined(this.now)){this.showSlide(this.options.startIndex);}},cycleBack:function(){if(this.now>0){this.showSlide(this.now-1);}else if(this.options.wrap){this.showSlide(this.slides.length-1);}},showSlide: function(iToShow){var now = this.now;var currentSlide = this.slides[now];var slide = this.slides[iToShow];//closurefunction fadeIn(s){s.setStyles({display:'block',visibility:'visible',opacity: 0});this.effects[this.slides.indexOf(s)].start(1);//from 0 to 1this.fireEvent('onShow',[slide,iToShow]);};if(slide) {if($chk(now) && now != iToShow){this.effects[now].start(0).chain(function(){this.slides[now].setStyle('display','none');fadeIn.apply(this, [slide]);}.bind(this));}else {fadeIn.apply(this,[slide]);}this.now = iToShow;}},});
原创粉丝点击