um, use a variable?

var x = true;
$("#container").click(function() {
        if (x) {
        $("#container").animate({"marginTop": "-=237px"}, "slow");
        } else {
        $("#container").animate({"marginTop": "400px"}, "slow");
        }
        x = !x;
});

On Feb 13, 3:05 pm, somedude <[EMAIL PROTECTED]> wrote:
> Ok sorry about the title, don't know what to say.
>
> I have a site for a client, and when you click a certain div it
> animates with a marginTop -=300px like effect so the div is just
> visible sliding in behind another div.
>
> Now, if the user clicks the div again it will do the same and go up by
> 300px. What I want is a toggle like function where if you click it the
> second time it now adds the 300px back and the div is back in place.
>
> so right now here is the setup code, very simple:
>
> $("#container").click(function() { $
> ("#container").animate({"marginTop": "-=237px"}, "slow"); });
>
> There has to be an easier way then to set a cookie stating
> "Clicked=yes" then reset to "No"
>
> Anyone?
>
> Thanks

Reply via email to