Q:

Problems with an slider i'm developing

I'm trying to build a full page slider. This is what i'm trying to build:

I declare this variables in the .js file:

var current = 0; // This is the id that is shown
var total = $('.post').length; // Total number of divs

The main structure of the html
<div class="controller">
    <a href="#" id="previous_slide"></a>
    <a href="#" id="next_slide"></a>
</div>

<ul id="slider">

    <li class="post" id="0"> 
       // Content
    </li>

    <li class="post" id="1"> 
       // Content
    </li>

</ul>

When the user clicks on "previous_slide" or "next_slide" button, the jquery calls to the go_slide() function and pass by reference an string depending or the action (go_before or go_after).
$("#previous_slide").click( go_slide("go_before") );
$("#next_slide").click( go_slide("go_after") );

function go_slide(action_name)
{
    var prev = current - 1;
    var next = current +1;

    if (action_name == "go_before") 
    {
        $('#'+current).hide();
        $('#'+previous).show():
        current--; // Updates the value of current slide
    }
    else if(action_name == "go_after")
    {
        $('#'+current).hide();
        $('#'+next).show():
        current++; // Updates the value of current slide
    }
}  

What can i do to run correct the code??
Thanks in advance

A:

generally i use like this：
$("#previous_slide").click( function() { go_slide("go_before") } );
$("#next_slide").click( function() {go_slide("go_after") } );

