Jump to content

Need help with Slideshow displaying 3 thumbnails


singingdoughnut

Recommended Posts

Hi

 

Im currently trying have images move to one side, while the page shows three images.  When one moves, the others move with it.  An alert displays what is needed, but the actual code will only work with one image.

 

Javascript code:

var maxThumbnails = imgArray.length;
var thumbnailIndex = 0;

function next(){

//get Julian's help


thumbnailIndex++;
if (thumbnailIndex >= imgArray.length)  {
	thumbnailIndex = 0;

}		
var index = thumbnailIndex;
for (var i = 0; i < maxThumbnails; i++) {
	//alert(imgArray[index]);
	index++;
	nextImg()

	//document.images.rollimg.src = imgArray[thumbnailIndex]

	if (index >= imgArray.length) {
		index = 0;
		document.images.rollimg.src = imgArray[thumbnailIndex]
		//nextImg()


	}

}


}

 

Here is the Html Code:

 

function displayThumbnails($ni) {
$images = scandir($ni);
$length = count($images);
$maxTM = 5;
$one = 3;

if ($length < $maxTM){
	$maxTM = $length;
}
//this smells
for ($i = 2; $i < $maxTM; $i++){ 
	$img = $images[$i];

	echo "<img src=\"$ni$img\" name = \"rollimg\" /> ";


}
}

// Displays the category headings
echo "<div id = \"heading\">";
echo "<h1>" . $category . "</h1>";
echo "</div>";

echo "<div id = \"category\"><ul>";
displayCategories("gallery/");
echo "</ul></div>";

echo "<button onClick = \"previousImg()\">Previous</button>";

displayThumbnails("gallery/$category/small/");
echo "<button onClick = \"next()\" name = \"next\">Next</button>";

 

Its not all the code, but that is just the main problem.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.