treehouse : what would you like to learn today?
Web Design Web Development iOS Development

problem with jquery image slider

  • Hi warriors
    I m new to jquery had just tried to make a horizontal image slider. Problem is clicking on 'next' btn should not work when on last slide, same with 'prev' button.

    can any one help me out.

    http://jsfiddle.net/matthew_b/6zrnW/1/
  • You need to add a step to both your previous and next functions - for example:

    $("#next").click( function(){
    alert('hi');
    $(current).animate({left: "-=1500px", top: "0px"}),

    {

    step: function(right) {
    if (left <= 1500px) { //Slide width x number of slides<br />
    $(current).stop(true, true);
    }


    }

    });