Slide animation

Slide animation

Hello jQuery developers!

I have this case, in which I try to do some div act like a slider, animate from left to right, and animate(out) to right:

A) THERE ARE 3 DIVS: a container, and its content (box-1, box-2)
#container
{width:720px; height:540px; background:gray; margin:0 auto;
   position:relative; overflow:hidden}

#box-1
{width:720px; height:540px; background:red; position:absolute; left:0}

#box-2
{width:720px; height:540px; background:orange; position:absolute; left:0}









B)
THERE ARE 2 ANCHORS: each href targets each of the previous box divs.
<ul>
    <li><a href="#box-1" id="button-box-1">Content #1 (Red)</a></li>
    <li><a href="#box-2" id="button-box-2">Content #2 (Blue)</a></li>                   
</ul>



C) THIS IS THE SCRIPT:
$(function(){
    $('#box-1, #box-2').hide().addClass('hidden').css({'left':'-720px'});
   
    $('ul li').click(function(event){
        target = $(event.target);
        if(target.is('a')){
            event.preventDefault();
                if ( $(target.attr("href")).hasClass("hidden") ){
                   
                    $(".visible").removeClass("visible")
                        .addClass("hidden")
                        .animate({'left':'0px'})
                        .hide()
                        .css('left','-720px')
                           
                    $(target.attr("href"))
                        .removeClass("hidden")
                        .addClass("visible")
                        .fadeIn('fast')
                        .animate({'left':'0px'})
                      
                  $(".visible").animate({'left':'800px'}).removeClass('active') // shows the
                                                                                                                                          //effect I want.
                                                                                                                              //Remove when testing
            };
        };
    });
});

































Can anyone help me, please?

Thanks