My goal is to make a slideshow. I have only 1 image here and plan to use more later.
<!DOCTYPE html>
<html onmousedown='event.preventDefault();'>
<head>
<title> Slides </title>
<meta charset='utf-8'>
<style>
table{
margin: 1.5in;
}
.arrow{
color: blue;
cursor: pointer;
}
I attempted to make the image class 640 x 540 pixels, centered both horizontally and vertically. I want to avoid internal padding. Not sure if it's right.
.img{
height: 540px;
width: 640px;
position: relative;
}
For the image element itself I put no margin, is 100% wide, has a 1 pixel solid black border.
#image{
width: 100%;
border: solid 1px;
border-color: black;
}
</style>
<script>
I want to make 2 globals, "images" and "imgidx". -images - an array that is filled in with the paths of the images in the images directory as strings.
-imgidx - a number initially set to 0.
Next I want to fill in the following functions.
-Increment or decrement imgidx.
-set the 'src' attribute on the img element (identified by the id 'img') to the image at images[imgidx]. If imgidx is > the number of images in the images array, it should wrap back to zero. If it goes below zero it should be set to 1 less than the length of the array.
function previmg() {
}
function nextimg() {
}
</script>
</head>
<body>
<table>
<tr>
<!-- Clicking on the arrows should change the image being displayed: -->
<td class='arrow' onclick='previmg();'> «
<td class='image'><img id='img' src='https://img-9gag-fun.9cache.com/photo/appxzbM_460s.jpg'>
<td class='arrow' onclick='nextimg();'> »
</table>
</body>
</html>
imgor did you want images to move around?imgor just that singleimgwhich changes its src based on what arrow you click?