$(function() { var $current = $("#container li"), len = $current.length-1, current = 0; $("#next, #prev").click( function(){ current += (this.id === 'next') ? 1 : -1; if (current < 0) { current = 0; return; } if (current > len) { current = len; return; } $current.animate({ left: -790*current, top: 0 }); });});
i have made a custom Jquery image slider with 'next' and 'prev' buttons but some how it is not working properly. The prob is it goes on sliding when the images over.
http://jsfiddle.net/matthew_b/suzgM/