Jquery slider next/previous-Tasten

Habe ich gebaut, ein regler, wo ich kann, klicken Sie auf die Bilder und es bewegt sich vorwärts. Ich bin versucht hinzuzufügen, die Schaltflächen Weiter und zurück aber ich habe Probleme. Jede Hilfe ist willkommen!

Hier ist eine demo, wo ich bin...
JSFiddle

<div id="container">

    <div class="next">Next</div>
    <div class="prev">Previous</div>

    <div id="image1" class="box">Orange</div>
    <div id="image2" class="box">Blue</div>
    <div id="image3" class="box">Green</div>
    <div id="image4" class="box">Red</div>
    <div id="image5" class="box">Yellow</div>

</div>

CSS

body {
    padding: 0px;    
}

.next {
    width:100px;
    height:50px;
}

.prev {
    width:100px;
    height:50px;
}

#container {
    position: absolute;
    margin: 0px;
    padding: 0px;
    width: 100%;
    height: 100%;
    overflow: hidden;

}

.box {
    position: absolute;
    width: 50%;
    height: 300px;
    line-height: 300px;
    font-size: 50px;
    text-align: center;
    left: 150%;
    top: 100px;
    margin-left: -25%;
}

#image1 {
    background-color: orange;
    left: 50%;
}

#image2 {
    background-color: blue;
}

#image3 {
    background-color: green;
}

#image4 {
    background-color: red;
}

#image5 {
    background-color: yellow;
}

JQUERY

$('.box').click(function() {

$(this).animate({
    left: '-50%'
}, 500, function() {
    $(this).css('left', '150%');
    $(this).appendTo('#container');
});

$(this).next().animate({
    left: '50%'
}, 500);
});​

Schreibe einen Kommentar