views:

49

answers:

1

I am looking to create an IF ELSE statement that says IF You reach the end of the UL LI, unbind click function from scroll button, ELSE bind click funtion

$(document).ready(function () {

    $('#down').click(function () {
        $(".project_thumbs").stop().animate({
            "top": "-=510px"
        });
    });
    $('#up').click(function () {
        $(".project_thumbs").stop().animate({
            "top": "+=510px"
        });


    });
});
A: 

As you are using positional movements, all you need to do is multiply the number of LI's by the height of the LI's, and then when the LI's CSS top position is that figure (negative or positive?) then you are at the final scroll.

I have done this here on the horizontal axis

function run_slider() {
var elm = $('#slider ul li');
ct = elm.length-1;
ct = ct*-920; // 920 = width of li's, but could easily be found using jQuery
var x = $(elm).css('left');
x = parseInt(x);
if (x == ct) {
$(elm).animate({
  left: '0px'
 },500);
}
else {
$(elm).animate({
  left: '-=920px'
 },500);
}
}
Liam Bailey
i am a little confused on how to implement your code into my function? I am newer to jquery and java, any tips
Goetzs