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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.