Fade out when user leaves page — jquery
- by Tom Julian Hume
I have some simple page transitions that fade in, once the user has landed. However, I'm also trying to make the same page fade out, when the user leaves.
I have found a few solutions, but they appeared to use delay(). Are there any that don't?
Thanks for any help, (I'm new to this, mind!)
Tom :)
I am currently using this code:
$(document).ready(
function(){
$( 'body' ).fadeIn(2000);
$('#stop').click(function (e) {
e.preventDefault(); });
$('#clients').click(function() {
$("#projectinfo").slideUp('slow');
$("#us").fadeOut('slow');
$("ul").fadeToggle('slow'); });
$('#information').click(function() {
$("#projectinfo").slideUp('slow');
$("ul").fadeOut('slow');
$("#us").fadeToggle('slow'); });
$('#question').click(function() {
$("#projectinfo").slideToggle('slow'); });
$('#question').hover(function() {
$("#projectinfo").slideToggle('slow'); });
$("a").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("body").fadeOut(1000, redirectPage);
});
function redirectPage() {
});