Jquery做的 ,比起JS要简洁多了
left=$(".left");
right=$(".right");
da=$(".da");
c=1;
left.click(function() {
if(c != 5) {
da.stop();
da.animate(
{
marginLeft: c * (-620) + "px"
},
1000,
function() {
c++;
})
}
})
right.click(function() {
if(c != 1) {
da.stop();
da.animate(
{
marginLeft: (c-2)* (-620) + "px"
},
1000,
function() {
c--;
})
}
})