1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
var PhotoSlider = function() { this.currentIndex = 0; this.timerId;
this.init = function(settings) { var self = this;
this.timerId = setInterval(function() { code = [] code.push('<a href="' + settings.bigPhoto[self.currentIndex] + '" target="_blank">'); code.push('<img src="' + settings.smallPhoto[self.currentIndex] + '" name="Image1" width="' + settings.width + '" height="' + settings.height + '" border="0">'); code.push('</a>');
document.getElementById(settings.id).innerHTML = code.join('')
if (self.currentIndex++ >= settings.smallPhoto.length - 1) { self.currentIndex = 0; !settings.loop && self.clearTimer() } }, settings.speed) }
this.clearTimer = function() { clearInterval(this.timerId); } }
new PhotoSlider().init({ id: 'Image1', smallPhoto: ["01/1s.jpg","01/2s.jpg","01/3s.jpg","01/4s.jpg","01/5s.jpg"], bigPhoto: ["01/1.jpg","01/2.jpg","01/3.jpg","01/4.jpg","01/5.jpg"], speed: 1000*2, width: 476, height: 300, loop: true })
|