I've built a slider where I can click the images and it moves forward. I'm am trying to add Next and Previous buttons but am having trouble. Any help is appreciated!
Here is a demo of where I am... JSFiddle
<div id="container">
<div class="next">Next</div>
<div class="prev">Previous</div>
<div id="image1" class="box">Orange</div>
<div id="image2" class="box">Blue</div>
<div id="image3" class="box">Green</div>
<div id="image4" class="box">Red</div>
<div id="image5" class="box">Yellow</div>
</div>
CSS
body {
padding: 0px;
}
.next {
width:100px;
height:50px;
}
.prev {
width:100px;
height:50px;
}
#container {
position: absolute;
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
overflow: hidden;
}
.box {
position: absolute;
width: 50%;
height: 300px;
line-height: 300px;
font-size: 50px;
text-align: center;
left: 150%;
top: 100px;
margin-left: -25%;
}
#image1 {
background-color: orange;
left: 50%;
}
#image2 {
background-color: blue;
}
#image3 {
background-color: green;
}
#image4 {
background-color: red;
}
#image5 {
background-color: yellow;
}
JQUERY
$('.box').click(function() {
$(this).animate({
left: '-50%'
}, 500, function() {
$(this).css('left', '150%');
$(this).appendTo('#container');
});
$(this).next().animate({
left: '50%'
}, 500);
});
Hey Check this one out: http://jsfiddle.net/Dwxfc/
This should fit your need,
:)
also note the above sample only have the next functionality hence it repeats itself.Rest hope it fits your need, please lemme know if this doesn't.
B-)
Code
HTML
CSS