Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

js picture rotation and...

I have the attached code rotating some images.

Question 1: How can I add a text box showing some description about the picture (please see the attache image)?
Question 2: How can add the little circles (one per pic) with the one led-up for the current picture?

I hope you can give me a working sample of some sort, if you have any, instead of writing about it.

Thank you.

HTML CODE:
===========================
<!DOCTYPE html>

<html>
	<head>
	<link type="text/css" href="main.css" rel="stylesheet"/>
	</head>

	<body>
	<div id = "project-pictures">
	<img src="images/img1.jpg" height="505" width="942"id="mainImage"/>
	</div>

	<script src="script.js"></script>

	</body>

</html>



JS CODE:
=======================
var myImage = document.getElementById("mainImage");

var imageArray = ["images/img2.jpg","images/img3.jpg"];

var imageIndex = 0;

function changeImage() {
	myImage.setAttribute("src",imageArray[imageIndex]);
	imageIndex++;
	if (imageIndex >= imageArray.length) {
	imageIndex = 0;
	}
}

var intervalHandle = setInterval(changeImage,5000);

Open in new window

Images.png
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Eghtebas

ASKER

Thank you.