I have implemented in HTML and CSS a code for when I finish loading a page I do it with an opacity transition from 0 to 1 (Appear or 'fade in').
I need to make another transition when I jump to another page. The current page must disappear ('fade out') making an opacity of 1 to 0 and then jump to the next link.
When I jump to another page, I do it through a button that is inside an iframe and with code-behind in C #.
For the transitions, implement the code of the 'body' element in HTML in this way:
<body style="opacity:0;" onload="document.body.style.opacity= '1'; document.body.style.transition='opacity 2s linear' " onunload="document.body.style.opacity='0'; document.body.style.transition='opacity 2s linear' ">
As I said before the transition when you just loaded the page with the attribute 'onload' works perfect.
code-behind:
Type cstype = this.GetType();
String csName = "RedirectScript";
String script = "window.parent.document.body.style.opacity= '0'; window.parent.location = '../siguiente.html'";
ClientScriptManager cs = Page.ClientScript;
cs.RegisterClientScriptBlock(cstype, csName, script.ToString(), true);