1

Please, is it possible to run an animation on the click of a browser button? And how?

I know it is possible with some Ajax manipulation, I believe.

Here is what I have now.

I got two divs with the class .wrapper both a 10% and sitting side by side in a parent div called .flatbed, width 1000%.

(Only one .wrapper class is revealed at a time.)

Now, when I click #new_workspace (a button), this happens

$('#new_workspace').click(function()
{
    $('.flatbed').animate({left:'-100%'}) 
});

This sends the first .wrapper class to left, out of the browser's viewport and reveals the second .wrapper class.

I reverse this animation with

    $('#back_to_workspace').click(function()
{
    $('.flatbed').animate({left:'0%'})

});

My problem now, is triggering this reverse animation with the browser back button. Help please :( Thanks.

Something like this http://www.marlene-portfolio.com/

Shoppyonline
  • 165
  • 5
  • 17

1 Answers1

2

You can't (browser security restriction). You can tell if the user navigates away from the page (onbeforeunload, onunload fire) but you can't tell where they went (back, forward, another url etc.). So in short its not possible to accomplish what you are trying to do.

Meisam Mulla
  • 1,845
  • 3
  • 23
  • 37