I've got a DIV which contains a varying amount of items from a database. I've set the DIV to animate plus/minus 894px from it's current position when the next/prev buttons are clicked. I'm now trying to stop it from animating past 0px or past it's last child but am struggling to get it working without using a fixed width DIV. Does anyone know of a solution? Thanks
http://jsfiddle.net/Drennan/mMMfn/
$('#right').each(
function(){
$(this).bind (
"click",
function(event){
$('#inner').animate(
{left:"-=894px"}, {
duration:'slow',
easing:'swing'
});
}
);
}
);
$('#left').each(
function(){
$(this).bind (
"click",
function(event){
$('#inner').animate(
{left:"+=894px"}, {
duration:'slow',
easing:'swing'
});
}
);
}
);
});