1(function ($) { 2 3 var Slider = function (container, options) { 4 if (!options) options = {}; 5 if (options.timeout) this.timeout = options.timeout; 6 7 //Set container 8 this.container = container; 9 10 //Get images 11 this.images = $('IMG', this.container); 12 13 //Reset vars 14 this.activeImage = 0; 15 16 //Create timer 17 var self = this; 18 setTimeout(function () { 19 self.next(); 20 setTimeout(arguments.callee, self.timeout); 21 }, this.timeout); 22 }; 23 24 Slider.prototype.next = function () { 25 var p = this.activeImage; 26 this.activeImage = (this.activeImage + 1 == this.images.length ? 0 : this.activeImage + 1); 27 28 this.images.eq(p).css('zIndex', 5); 29 this.images.eq(this.activeImage) 30 .removeClass('hidden') 31 .css({zIndex: 4, opacity: 1, display: 'block'}); 32 33 this.images.eq(p).animate({opacity: 0}, 'fast'); 34 }; 35 36 Slider.prototype.timeout = 5000; 37 38 Slider.activeImage = 0; 39 40 Slider.prototype.container = null; 41 42 Slider.prototype.images = []; 43 44 $.fn.slider = function (o) { 45 new Slider(this, o); 46 }; 47 48})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.