How to run an animated jQuery inside a function?

I have completed the jQuery challenges, and now I am running some tests.

I know that I can run a animation using:

$(document).ready(function() {
 $("#photo").addClass("animated shake");

But it appears to run just in the load of the page. How do I perform this animation again, like inside a function or some time later the load of the page?

Thank you, it works fine now.