settimeout problem

Hallo Quaese,
leider laedten sich die Slides bei Aufruf der Seite. Trotz kleiner Anpassungen an meine Beduerfnisse, d.h. <script src="includes/SpryEffects.js" type="text/javascript"></script> und

// Array mit "Slide-Variablen"
arrSlides = {
slide_horizphoto,
slide_horiz,
slide_next
};

hast du eine Idee was schief laeuft?
Danke!
 
Hallo Quaese,
ich habe mir den code mal genau sngeschaut und zu meinem Nutzen umgebaut. Das klappt nun auch toll!
allerdings habe ich nun Schwierigkeiten die Photoslides einzubeziehen. Ich ging davon aus, dass ich einfach nur den vorhanden Teil kopieren und die Namen der Variablen aendern muesste, das klappt allerdings nicht. Siehst du den Fehler?

Code:
	<script type="text/javascript">
var observer = {};

observer.nextEffect = false;
observer.onPostEffect = function(e){
	if (this.nextEffect)
	{
		var eff = this.nextEffect;
		setTimeout(function(){eff.start();}, 10);
	}

	this.nextEffect = false;
}

function myPanelsSlides(currentPanel)
{
    // The list of all the panels that need sliding
	var panels = ['slide0','slide1', 'slide2', 'slide3', 'slide4','slide5', 'slide6'];
	var opened = -1;

	// Let's check if we have an effect for each of these sliding panels
	if (typeof effects == 'undefined')
		effects = {};

	for (var i=0; i < panels.length; i++)
	{
		if (typeof effects[panels[i]] == 'undefined'){
			effects[panels[i]] = new Spry.Effect.Slide(panels[i], {horizontal: true,from: '0%', to: '100%', toggle: true});
			effects[panels[i]].addObserver(observer);
		}
		 
		if (effects[panels[i]].direction == Spry.forwards && currentPanel != panels[i])
			opened = i;

		//prevent too fast clicks on the buttons
		if (effects[panels[i]].direction == Spry.backwards && effects[panels[i]].isRunning)
		{
			observer.nextEffect = effects[currentPanel];
			return;
		}
	}

	if (opened != -1)
	{
		observer.nextEffect = effects[currentPanel];
		effects[panels[opened]].start();
	} 
	else if (effects[currentPanel].direction != Spry.forwards)
	{
		effects[currentPanel].start();
	}
};
var phobserver = {};

phobserver.nextEffect = false;
phobserver.onPostEffect = function(e){
	if (this.nextEffect)
	{
		var pheff = this.nextEffect;
		setTimeout(function(){pheff.start();}, 10);
	}

	this.nextEffect = false;
}

function myPhotoSlides(currentPhoto)
{
    // The list of all the panels that need sliding
	var photos = ['photo0'];
	var phopened = -1;

	// Let's check if we have an effect for each of these sliding panels
	if (typeof effects == 'undefined')
		effects = {};

	for (var k=0; k < photos.length; k++)
	{
		if (typeof effects[photos[k]] == 'undefined'){
			effects[photos[k]] = new Spry.Effect.Slide(photos[k], {horizontal: true,from: '0%', to: '100%', toggle: true});
			effects[photos[k]].addObserver(observer);
		}
		 
		if (effects[photos[k]].direction == Spry.forwards && currentPhoto != photos[k])
			phopened = k;

		//prevent too fast clicks on the buttons
		if (effects[photos[k]].direction == Spry.backwards && effects[photos[k]].isRunning)
		{
			phobserver.nextEffect = effects[currentPhoto];
			return;
		}
	}

	if (phopened != -1)
	{
		phobserver.nextEffect = effects[currentPhoto];
		effects[photos[opened]].start();
	} 
	else if (effects[currentPhoto].direction != Spry.forwards)
	{
		effects[currentPhoto].start();
	}
};
window.onload = function(){
  //slide_horizphoto = new Spry.Effect.Slide('slide_photobox', {duration:1250, horizontal: true, from:'0%', to:'100%', toggle: true});
  fadeElement = new Spry.Effect.Fade("fade_menu", {duration:500, from:'0%', to:'100%',  toggle:true});
  fadeElement.start();
  setTimeout(function(){
  myPanelsSlides('slide0'); value="Slide 0";
  }, 500);
  setTimeout(function(){
  myPhotoSlides('photo0'); phvalue="photo 0";
  }, 750);
  //setTimeout(function(){
  //slide_horizphoto.start();
  //}, 750);
};
</script>
</head>
<body bgcolor="#333333" style="overflow-y:hidden;overflow-x:hidden">

<div id="fade_menu">
    <div class="menubox">
      <a href="#nogo" onClick="myPanelsSlides('slide0');" value="Slide 0"><img src="Bilder/name.jpg" width="270"></a>
        <ul id="menu">
         <li><a href="#nogo" onClick="myPanelsSlides('slide1');myPhotoSlides('photo0');" value="Slide 1" phvalue="photo 0">Speisen & Weine</a></li>
         <li><a href="#nogo" onClick="myPanelsSlides('slide2');" value="Slide 2">Veranstaltungen</a></li>
         <li><a href="#nogo" onClick="myPanelsSlides('slide3');" value="Slide 3">Specials</a></li>
         <li><a href="#nogo" onClick="myPanelsSlides('slide4');" value="Slide 4">Ausfluege</a></li>
         <li><a href="#nogo" onClick="myPanelsSlides('slide5');" value="Slide 5">Historie</a></li>
         <li><a href="#nogo" onClick="myPanelsSlides('slide6');" value="Slide 6">Kontakt</a></li>
         </ul>
         <br>
         <br>
         <img src="Bilder/haus.jpg" width="270">
    </div>
  </div>
 
Zuletzt bearbeitet:
Hi,

ich hab ehrlich gesagt keine grosse Lust, mich durch den Quellcode zu ackern. Was ich gepostet hatte, hat funktioniert. Du hast nur das Array mit geschweiften Klammern statt mit eckigen Klammern definiert. Deshalb auch die Funktionsverweigerung.

Ciao
Quaese
 
Zurück