Page to page fading effect

i need to implement load/unload page animations fade-in on load, and fade-out on unload.

1) I have read some articles about implementation it based on links clicks. That's does not work for me. I don't want to go that way, because some links should not open new page actually, and have href.

So imagine: link has properly href, but sometimes it open new page, sometimes not, based on it handler behavior. We add another handler that fire redirect all the time as timeout callback.

Actually i was finding the way without using links event, but using any UNLOAD event. Links events can be used only on a small website. In my case it created additional errors. For example some links, shouldn't do fade-out, and i don't know which of them actually.

So i don't recommend to do this. Need to find any UNLOAD page redirections animation way.