Lid | 
                 | 
                
				
				Hoi allemaal, 
 
Ik ben bezig geweest met het verspringen van beeld, het lukt, maar het gaat niet heel erg vloeiend. 
 
Wie heeft er een idee hoe dit vloeiender kan? 
 
Code: 
    
    
        
            
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<SCRIPT LANGUAGE="JavaScript">
var interval = 2; // tijd tussen wisselen van de afbeeldingen (in seconden)
var random_display = 0; // 0 = vaste volgorde, 1 = willekeurige volgorde
interval *= 1000;
var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Koala.jpg");<!-- afb 1 -->
image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Jellyfish.jpg");<!-- afb 2 -->
image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Desert.jpg");<!-- afb 3 -->
image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Lighthouse.jpg");<!-- afb 4 -->
image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Hydrangeas.jpg");<!-- afb 5 -->
                                                                   <!-- enz.. -->
var number_of_image = image_list.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}
function beeldwissel(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "beeldwissel('"+place+"')";
setTimeout(recur_call, interval);
}
</script>	
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery</title>
</head>
<body>
<BODY OnLoad="beeldwissel('beeld')">
<img name="beeld" src="../../Public/Pictures/Sample Pictures/Koala.jpg" width=500 height=450; src="../../Public/Pictures/Sample Pictures/Jellyfish.jpg"; src="../../Public/Pictures/Sample Pictures/Desert.jpg"; src="../../Public/Pictures/Sample Pictures/Lighthouse.jpg"; src="../../Public/Pictures/Sample Pictures/Hydrangeas.jpg"/>
 
								
</body>
</html>
             
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <SCRIPT LANGUAGE="JavaScript">   var interval = 2; // tijd tussen wisselen van de afbeeldingen (in seconden) var random_display = 0; // 0 = vaste volgorde, 1 = willekeurige volgorde interval *= 1000;   var image_index = 0; image_list = new Array(); image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Koala.jpg");<!-- afb 1 --> image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Jellyfish.jpg");<!-- afb 2 --> image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Desert.jpg");<!-- afb 3 --> image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Lighthouse.jpg");<!-- afb 4 --> image_list[image_index++] = new imageItem("../../Public/Pictures/Sample Pictures/Hydrangeas.jpg");<!-- afb 5 -->                                                                    <!-- enz.. --> var number_of_image = image_list.length; function imageItem(image_location) { this.image_item = new Image(); this.image_item.src = image_location; } function get_ImageItemLocation(imageObj) { return(imageObj.image_item.src) } function generate(x, y) { var range = y - x + 1; return Math.floor(Math.random() * range) + x; } function getNextImage() { if (random_display) { image_index = generate(0, number_of_image-1); } else { image_index = (image_index+1) % number_of_image; } var new_image = get_ImageItemLocation(image_list[image_index]); return(new_image); } function beeldwissel(place) { var new_image = getNextImage(); document[place].src = new_image; var recur_call = "beeldwissel('"+place+"')"; setTimeout(recur_call, interval); }   </script>	   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery</title> </head>   <body>   <BODY OnLoad="beeldwissel('beeld')">   <img name="beeld" src="../../Public/Pictures/Sample Pictures/Koala.jpg" width=500 height=450; src="../../Public/Pictures/Sample Pictures/Jellyfish.jpg"; src="../../Public/Pictures/Sample Pictures/Desert.jpg"; src="../../Public/Pictures/Sample Pictures/Lighthouse.jpg"; src="../../Public/Pictures/Sample Pictures/Hydrangeas.jpg"/>     </body> </html> 
 
  
         
          
     
  
 
Alvast bedankt  !				
				 |