Hello,
I’m having a little bit of trouble with an image slider I am doing. I need it to loop to the beginning of the slide show when it reaches the end of the images
Here is my markup:
[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>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title>Twin Tiers Technologies – Image Slider</title>
<link href=”styles.css” rel=”stylesheet” type=”text/css” />
<script src=”jquery-1.4.4.min.js” type=”text/javascript”></script>
<script src=”scripts.js” type=”text/javascript”></script>
</head>
<body>
<div id=”wrapper”>
<div id=”container”>
<div id=”mask”>
<div id=”slider”>
<div id=”images”>
<img src=”images/web.jpg” alt=”Websites” />
<img src=”images/mims.jpg” alt=”Mortuary Information Management System” />
<img src=”images/cims.jpg” alt=”Cremetory Information Managment System” />
<img src=”images/motv.jpg” alt=”Memories On TV” />
<img src=”images/web-casting.jpg” alt=”Web Casting” />
<img src=”images/support.jpg” alt=”Support” />
</div>
</div>
</div>
</div>
<img src=”images/arrow-back.png” id=”back” />
<img src=”images/arrow-forward.png” id=”forward” />
</div>
</body>
</html>
Here is my CSS
[CODE]@charset “UTF-8”;
/* CSS Document */
#wrapper{
width: 902px;
margin: 200px auto;
}
#container{
width: 861px;
height: 225px;
margin: 0 auto;
background-image:url(images/slider-bg.png);
background-repeat: no-repeat;
}
#mask{
width: 731px;
height: 225px;
margin: 20px auto;
overflow: hidden;
}
#slider{
width: 2000px;
}
#slider img{
float: left;
padding: 5px;
}
#back{
float: left;
position: relative;
top: -140px;
}
#forward{
float: right;
position: relative;
top: -140px;
}
#images{
position: relative;
float: left;
}
and finally my script
[CODE]// JavaScript Document
$(document).ready(function () {
$(‘#back’).click(function (){
$(‘#images’).animate({“left”: “+=757px”}, 1000);
})
$(‘#forward’).click(function () {
$(‘#images’).animate({“left”: “-=757px”}, 1000);
var $next = $active.next().length ? $active.next()
: $(‘#slideshow IMG:first’);
})
})
Anyone have any suggestions?