Autor | Zpráva | ||
---|---|---|---|
Cendis Profil * |
Dobrý den, chtěl jsem vytvořit menu kde se automaticky po nějakém intervalu mění obrázky a zároveň přeskočí i nabídka v menu na další položku, toho jsem se dopracoval že jsem si stáhl tento skript (viz. níže), ale potřeboval bych ještě změnit interval po jaké době se to má měnit. Nevíte někdo jak na to? :-)
var BarackSlideshow = new Class({ Extends: Fx.MorphList, options: {/* onShow: $empty,*/ auto: false, autostart: false, autointerval: 2000, transition: 'fade', tween: { duration: 1000 } }, initialize: function(menu, images, loader, options){ this.parent(menu, options); this.images = $(images); this.imagesitems = this.images.getChildren().fade('hide'); $(loader).fade('in'); new Asset.images(this.images.getElements('img').map(function(el) { return el.setStyle('display', 'none').get('src'); }), { onComplete: function() { this.loaded = true; $(loader).fade('out'); if (this.current) this.show(this.items.indexOf(this.current)); else if (this.options.auto && this.options.autostart) this.progress(); }.bind(this) }); if ($type(this.options.transition) != 'function') this.options.transition = $lambda(this.options.transition); }, auto: function(){ if (!this.options.auto) return false; $clear(this.autotimer); this.autotimer = this.progress.delay(this.options.autointerval, this); }, onClick: function(event, item){ this.parent(event, item); event.stop(); this.show(this.items.indexOf(item)); $clear(this.autotimer); }, show: function(index) { if (!this.loaded) return; var image = this.imagesitems[index]; if (image == this.curimage) return; image.set('tween', this.options.tween).dispose().inject(this.curimage || this.images.getFirst(), this.curimage ? 'after' : 'before').fade('hide'); image.getElement('img').setStyle('display', 'block'); var trans = this.options.transition.run(null, this).split('-'); switch(trans[0]){ case 'slide': var dir = $pick(trans[1], 'left'); var prop = (dir == 'left' || dir == 'right') ? 'left' : 'top'; image.fade('show').setStyle(prop, image['offset' + (prop == 'left' ? 'Width' : 'Height')] * ((dir == 'bottom' || dir == 'right') ? 1 : -1)).tween(prop, 0); break; case 'fade': image.fade('in'); break; } image.get('tween').chain(function(){ this.auto(); this.fireEvent('show', image); }.bind(this)); this.curimage = image; this.setCurrent(this.items[index]) this.morphTo(this.items[index]); return this; }, progress: function(){ var curindex = this.imagesitems.indexOf(this.curimage); this.show((this.curimage && (curindex + 1 < this.imagesitems.length)) ? curindex + 1 : 0); } }); Moderátor Chamurappi: Vkládej prosím kódy mezi značky [>pre] a [>/pre] (stačí kliknout na ). Moderátor Chamurappi: Titulek „Jak změnit interval ?“ nevystihuje podstatu dotazu. Příště zkus prosím vymyslet lepší.
|
||
Medvídek Profil |
#2 · Zasláno: 20. 4. 2011, 13:47:56
autointerval: 2000, |
||
Cendis Profil * |
#3 · Zasláno: 20. 4. 2011, 14:57:58
To jsem právě změnil a prodleva změn obrázků byla stále stejná. Pak jsem ještě měnil toto: tween: { duration: 1000 } a tím jsem měnil prodlevu přechodu viditelnosti obrázku. Ale já bych potřeboval, aby mi zůstal jeden obrázek stát cca 10 vteřin a pak teprve začal přecházet na jiný.
|
||
Keeehi Profil |
#4 · Zasláno: 20. 4. 2011, 15:03:07
zkuste
auto: true, autointerval: 10000 |
||
Cendis Profil * |
#5 · Zasláno: 20. 4. 2011, 15:10:49
|
||
Časová prodleva: 13 let
|
0