Selecting pictures with Jquery and Javascript

Posted by Axschech on Stack Overflow See other posts from Stack Overflow or by Axschech
Published on 2012-12-07T23:00:24Z Indexed on 2012/12/07 23:03 UTC
Read the original article Hit count: 299

Filed under:
|
|

I'm testing out a layout on a website using 3 pictures here:

Schechterbusiness.info

the left button works, making it go through the pictures. But I can't figure out how to get the right button to work, which is supposed to scroll through the other way. I know there's probably a way to do it with arrays but I can't wrap my brain around it. Halp!

Code to scroll through pictures:

$('#fryLink').click(function() {
        $('#hide').hide();
        $('#img').hide();

    count++;

        if(count == 1) {

        $('#img').attr("src","images/fry.png");

        }
        else if(count == 2) {

        $('#img').attr("src","images/bender.png");

        }
        else if(count == 3) {

        $('#img').attr("src","images/zoidberg.png");
        }


                $('#img').show("fade");





        if(count > 2) {

        count = 0;
        }

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery