Loading content over content/div over div?

Loading content over content/div over div?

I was wondering how I would go about if I had a navigation with a few links, and when the user clicked a link, content would either load in a div, or the div would slide in and the content would fade in.

However, I'm having trouble as to how I would make it so that when a user clicks on another link, the previously loaded content had an exit animation or was removed before the new content was loaded.

What syntax should I be looking at to become familiar with putting this together?