Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Fade Out between pages Re: Fade Out between pages

#131070
tomscustoms
Member

I know this is an old thread but I couldnt help notice the code that was posted… Everything soap posted will work perfectly fine for what youre trying to do, he just forgot to pass the event object.

The code below should get you the effect you were looking for:


$(document).ready(function() {
$('body').css('display', 'none');
$('body').fadeIn(1000);

$('.link').click(function(event) {
event.preventDefault();
newLocation = this.href;
$('body').fadeOut(1000, newpage);
});

function newpage() {
window.location = newLocation;
}
});

If you notice, the only difference in the code above and what soap posted was on the line with


$('.link').click(function() {

it should have read


$('.link').click(function(event) {

Hopefully this helps someone out in the future :)