• Das Erstellen neuer Accounts wurde ausgesetzt. Bei berechtigtem Interesse bitte Kontaktaufnahme über die üblichen Wege. Beste Grüße der Admin

Brauche Hilfe bei einem Animations Script !

kwkurzer

New member
Hallo,

hier mein script.

Code:
$(document).ready(function() {

/** LINK_1 ***********************************************************************************/
	$('#start1_btn_1').click(function(){
		$('[id^="start1"], [id^="start2"], [id^="start3"]').stop(true).hide();
		$('[id^="sitemap"], [class^="infopic"]').fadeOut(500);
		$('#back_btn, #rose_first_a, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
		$('#rose_second_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_first_b').hide();
		clearTimeout(timeout1);
		})
		$('#rose_first_b').click(function(){
			$('#rose_first_a, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_second_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_first_b').hide();
		})
		$('#rose_second_b').click(function(){
			$('#rose_second_a, #rose_first_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_second_b').hide();
		})
		$('#rose_third_b').click(function(){
			$('#rose_third_a, #rose_first_b, #rose_second_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b,#rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_third_b').hide();
		})
		$('#rose_fourth_b').click(function(){
			$('#rose_fourth_a, #rose_first_b, #rose_second_b, #rose_third_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_third_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_fourth_b').hide();
		})
		$('#rose_fifth_b').click(function(){
			$('#rose_fifth_a, #rose_first_b, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_third_a, #rose_fourth_a, #rose_sixth_a, #rose_seventh_a, #rose_fifth_b').hide();
		})
		$('#rose_sixth_b').click(function(){
			$('#rose_sixth_a, #rose_first_b, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_seventh_a, #rose_sixth_b').hide();
		})
		$('#rose_seventh_b').click(function(){
			$('#rose_seventh_a, #rose_first_b, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_b').hide();
		})
});
/** ANIMATION ***********************************************************************************/

	function moveAnimated1() {
		$('#sitemap_btn_1').addClass('active');
		$('#sitemap_btn_2, #sitemap_btn_3').removeClass('active');
		$('#start1_note').fadeIn(700);
		$('#start1_btn_4').delay(700).fadeIn(1000);
		$('#start1_btn_9, #start1_btn_12').delay(1600).fadeIn(1000);
		$('#start1_btn_10').delay(2300).fadeIn(1000);
		$('#start1_btn_3, #start1_btn_5, #start1_btn_11').delay(3000).fadeIn(1000);
		$('#start1_btn_6').delay(3700).fadeIn(1000);
		$('#start1_btn_2').delay(4200).fadeIn(1000);
		$('#start1_btn_1, #start1_btn_7').delay(5000).fadeIn(1000);
		$('#start1_btn_13, #start1_btn_14').delay(5900).fadeIn(1000);
		$('#start1_btn_8, #start1_btn_15').delay(6300).fadeIn(1000);
		$('#start1_btn_16').delay(6700).fadeIn(1000);
		$('[id^="start2"], [id^="start3"]').stop(true).hide();
		timeout1 = setTimeout('moveAnimated2()', 16000);
	}
	
	function moveAnimated2() {
		$('#sitemap_btn_2').addClass('active');
		$('#sitemap_btn_1, #sitemap_btn_3').removeClass('active');
		$('#start2_note').fadeIn(700);
		$('#start2_btn_14').delay(700).fadeIn(1000);
		$('#start2_btn_12, #start2_btn_13, #start2_btn_16').delay(1600).fadeIn(1000);
		$('#start2_btn_7, #start2_btn_10').delay(2300).fadeIn(1000);
		$('#start2_btn_4, #start2_btn_15').delay(3000).fadeIn(1000);
		$('#start2_btn_3').delay(3700).fadeIn(1000);
		$('#start2_btn_6, #start2_btn_9, #start2_btn_11').delay(4200).fadeIn(1000);
		$('#start2_btn_1').delay(5000).fadeIn(1000);
		$('#start2_btn_2').delay(5900).fadeIn(1000);
		$('#start2_btn_5').delay(6300).fadeIn(1000);
		$('#start2_btn_8').delay(6700).fadeIn(1000);
		$('[id^="start1"], [id^="start3"]').stop(true).hide();
		timeout2 = setTimeout('moveAnimated3()', 16000);
	}
	
	function moveAnimated3() {
		$('#sitemap_btn_3').addClass('active');
		$('#sitemap_btn_1, #sitemap_btn_2').removeClass('active');
		$('#start3_note').fadeIn(700);
		$('#start3_btn_9').delay(700).fadeIn(1000);
		$('#start3_btn_1, #start3_btn_4, #start3_btn_15').delay(1600).fadeIn(1000);
		$('#start3_btn_3, #start3_btn_16').delay(2300).fadeIn(1000);
		$('#start3_btn_2').delay(3000).fadeIn(1000);
		$('#start3_btn_7, #start3_btn_13').delay(3700).fadeIn(1000);
		$('#start3_btn_5, #start3_btn_14').delay(4200).fadeIn(1000);
		$('#start3_btn_6').delay(5000).fadeIn(1000);
		$('#start3_btn_12').delay(5900).fadeIn(1000);
		$('#start3_btn_11').delay(6300).fadeIn(1000);
		$('#start3_btn_8, #start3_btn_10').delay(6700).fadeIn(1000);
		$('[id^="start1"], [id^="start2"]').stop(true).hide();
		timeout3 = setTimeout('moveAnimated1()', 16000);
	}

Habe hier drei Timouts generiert: "timeout1" "timeout2" "timeout3"

Wie kann ich all diese durch den klick auf z.B.: "#start1_btn_1" stoppen.
Bisher funktionier nur ein "clearTimeout(timeout1);".

Danke schon mal für die Hilfe.
 
timeouts stoppen geht nur über clearTimeout.
Animationen mit jQuery allerdings kannst du über stop anhalten, was du aber anscheinend schon weißt.
Wenn deine Frage ist, wie du dynamisch generierte timeouts stoppen kannst, empfehle ich ein array, wo du die timeouts reinpushst und durch dieses dann iterierst, wenn du sie stoppen willst
 
Ich würde an deiner Stelle das ganze nochmal anders aufrollen und mit Klassen arbeiten. Das kann ja keiner mehr lesen und das nur weil es sinnlose Codedopplungen sind.

Code:
		$('#rose_first_b').click(function(){
			$('#rose_first_a, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_second_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_first_b').hide();
		})
  
		$('#rose_second_b').click(function(){
			$('#rose_second_a, #rose_first_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_second_b').hide();
		})
        
		$('#rose_third_b').click(function(){
			$('#rose_third_a, #rose_first_b, #rose_second_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b,#rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_third_b').hide();
		})
        
		$('#rose_fourth_b').click(function(){
			$('#rose_fourth_a, #rose_first_b, #rose_second_b, #rose_third_b, #rose_fifth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_third_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_a, #rose_fourth_b').hide();
		})
		$('#rose_fifth_b').click(function(){
			$('#rose_fifth_a, #rose_first_b, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_sixth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_third_a, #rose_fourth_a, #rose_sixth_a, #rose_seventh_a, #rose_fifth_b').hide();
		})
		$('#rose_sixth_b').click(function(){
			$('#rose_sixth_a, #rose_first_b, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_seventh_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_seventh_a, #rose_sixth_b').hide();
		})
		$('#rose_seventh_b').click(function(){
			$('#rose_seventh_a, #rose_first_b, #rose_second_b, #rose_third_b, #rose_fourth_b, #rose_fifth_b, #rose_sixth_b, #rose_note').fadeIn(1000);
			$('#rose_first_a, #rose_second_a, #rose_third_a, #rose_fourth_a, #rose_fifth_a, #rose_sixth_a, #rose_seventh_b').hide();
		})

Das kannst du mit der richtigen Kombination aus Klassen und jQuery Selektoren in einem Event abarbeiten.
Selbst jetzt könntest du das ganze auf ein Event runter brechen...z.B.: mit $('[id^=rose_][id$=_b]').click(function () {});


Zeig mal dein HTML-DOM dazu.... das kann man sicher noch eleganter lösen.
 
Die Seite besteht aus sehr vielen Bildern die beim Klick auf einem Start Button das Untermenü "Rose" z.B. öffnet.

HTML:
<div class="container" id="cont">

        <div class="pic" id="start1_btn_1" style="margin: 39px 0 0 97px"><img src="pictures/start1_r1_c1.jpg" width="183" height="111"></div>
        <div class="pic" id="start1_btn_2" style="margin: 156px 0 0 0"><img src="pictures/start1_r1_c2.jpg" width="280" height="137"></div>
        <div class="pic" id="start1_btn_3" style="margin: 299px 0 0 84px"><img src="pictures/start1_r1_c3.jpg" width="196" height="98"></div>
        <div class="pic" id="start1_btn_4" style="margin: 0 0 0 286px"><img src="pictures/start1_r2_c1.jpg" width="351" height="222"></div>
        <div class="pic" id="start1_btn_5" style="margin: 227px 0 0 286px"><img src="pictures/start1_r2_c2.jpg" width="130" height="79"></div>
        <div class="pic" id="start1_btn_6" style="margin: 312px 0 0 286px"><img src="pictures/start1_r2_c3.jpg" width="104" height="53"></div>
        <div class="pic" id="start1_btn_7" style="margin: 227px 0 0 422px"><img src="pictures/start1_r2_c4.jpg" width="352" height="144"></div>
        <div class="pic" id="start1_btn_8" style="margin: 156px 0 0 643px"><img src="pictures/start1_r2_c5.jpg" width="131" height="66"></div>
        <div class="pic" id="start1_btn_9" style="margin: 104px 0 0 695px"><img src="pictures/start1_r2_c6.jpg" width="79" height="46"></div>
        <div class="pic" id="start1_btn_10" style="margin: 52px 0 0 695px"><img src="pictures/start1_r2_c7.jpg" width="79" height="46"></div>
        <div class="pic" id="start1_btn_11" style="margin: 85px 0 0 779px"><img src="pictures/start1_r3_c1.jpg" width="91" height="53"></div>
        <div class="pic" id="start1_btn_12" style="margin: 143px 0 0 779px"><img src="pictures/start1_r3_c2.jpg" width="235" height="313"></div>
        <div class="pic" id="start1_btn_13" style="margin: 78px 0 0 1020px"><img src="pictures/start1_r4_c1.jpg" width="144" height="189"></div>
        <div class="pic" id="start1_btn_14" style="margin: 273px 0 0 1020px"><img src="pictures/start1_r4_c2.jpg" width="280" height="144"></div>
        <div class="pic" id="start1_btn_15" style="margin: 201px 0 0 1170px"><img src="pictures/start1_r4_c3.jpg" width="130" height="66"></div>
        <div class="pic" id="start1_btn_16" style="margin: 143px 0 0 1170px"><img src="pictures/start1_r4_c4.jpg" width="104" height="52"></div>
        <div class="startnote" id="start1_note" style="margin: 0 0 0 1020px">Messe- und Interiordesign<br>
        Visualisierungen<br>
        Industrial Design
        </div>

        <div class="index" id="rose_first_a" style="margin: 26px 0 0 305px"><img src="pictures/pic_r27_c1.jpg" width="535" height="404"></div>
        <div class="index" id="rose_second_a" style="margin: 26px 0 0 305px"><img src="pictures/pic_r27_c2.jpg" width="535" height="404"></div>
        <div class="index" id="rose_third_a" style="margin: 26px 0 0 305px"><img src="pictures/pic_r27_c3.jpg" width="535" height="404"></div>
        <div class="index" id="rose_fourth_a" style="margin: 26px 0 0 305px"><img src="pictures/pic_r27_c4.jpg" width="535" height="404"></div>
        <div class="index" id="rose_fifth_a" style="margin: 26px 0 0 305px"><img src="pictures/pic_r27_c5.jpg" width="535" height="404"></div>
        <div class="index" id="rose_sixth_a" style="margin: 26px 0 0 305px"><img src="pictures/pic_r27_c6.jpg" width="535" height="404"></div>
        <div class="index" id="rose_seventh_a" style="margin: 26px 0 0 305px"><img src="pictures/pic_r27_c7.jpg" width="535" height="404"></div>
        <div class="small" id="rose_first_b" style="margin: 137px 0 0 1002px"><img src="pictures/pic_r27_c1.jpg" width="212" height="160"></div>
        <div class="small" id="rose_second_b" style="margin: 137px 0 0 926px"><img src="pictures/pic_r27_c2.jpg" width="66" height="50"></div>
        <div class="small" id="rose_third_b" style="margin: 227px 0 0 850px"><img src="pictures/pic_r27_c3.jpg" width="93" height="70"></div>
        <div class="small" id="rose_fourth_b" style="margin: 307px 0 0 850px"><img src="pictures/pic_r27_c4.jpg" width="93" height="70"></div>
        <div class="small" id="rose_fifth_b" style="margin: 307px 0 0 953px"><img src="pictures/pic_r27_c5.jpg" width="73" height="55"></div>
        <div class="small" id="rose_sixth_b" style="margin: 137px 0 0 850px"><img src="pictures/pic_r27_c6.jpg" width="66" height="50"></div>
        <div class="small" id="rose_seventh_b" style="margin: 37px 0 0 850px"><img src="pictures/pic_r27_c7.jpg" width="119" height="90"></div>
        <div class="note" id="rose_note" style="margin: 0 0 0 1020px">Architekturvisualisierung<br>
        DutyFree Shops Airport Moskau.<br>
        Modeling und Visualisierung<br>
        Für ARNO GmbH.
        </div>
        
</div>
 
Zurück
Oben