Slideshow wechselt nicht richtig

Xym

Erfahrenes Mitglied
Hey!

Ich habe eine einfach Slideshow mit jQuery erstellt.

Läuft eigentlich auch richtig ab, nur werden immer 2 Bilder gewechselt und nicht wie gewünscht 6.

Außerdem ist der Code ziemlich unschön, war einen Notlösung. Wäre nett wenn ihr bessere Vorschläge habt.

HTML:
<div id="slideshow">
				<img src="images/slide1.jpg" width="620" height="280" id="bild1">
				<img src="images/slide2.jpg" width="620" height="280" id="bild2" style="opacity:0">
				<img src="images/slide3.jpg" width="520" height="220" id="bild2" style="opacity:0">
				<img src="images/slide4.jpg" width="520" height="220" id="bild2" style="opacity:0">
				<img src="images/slide5.jpg" width="520" height="220" id="bild2" style="opacity:0">
				<img src="images/slide6.jpg" width="520" height="220" id="bild2" style="opacity:0">
			  </div>

Javascript:
setInterval ("slideshow()", 0);

function slideshow() {	
	m_out('#bild1');
	m_in('#bild2');
	m_out('#bild2');
	m_in('#bild3');
	m_out('#bild3');
	m_in('#bild4');
	m_out('#bild4');
	m_in('#bild5');
	m_out('#bild5');
	m_in('#bild6');
	m_out('#bild6');
	m_in('#bild1');
}

function m_in (id) {
	$(id).animate({
		opacity: 1
	}, 5000).delay(5000);
	
}

function m_out (id) {
	$(id).animate({
		opacity: 0
	}, 5000).delay(5000);	
}
 
Zuletzt bearbeitet von einem Moderator:

Neue Beiträge

Zurück