Forums

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

Home Forums CSS Fade Out between pages Reply To: Fade Out between pages

#199627
wired420
Participant

To get this to work with other code I had to change one line. Changing this one line made it interchangeable with my other modules and packages. Don’t see where it would hurt for anyone else to use it either for compatibility sake. It will also work if you say set a whole div or li in a menu bar to be a link or hover element.

This line

newLocation = this.href;

Was replaced with this one

newLocation = $('.link a').attr("href");

For a final code

$(document).ready(function() {
  $('body').css('display', 'none');
  $('body').fadeIn(1000);
  $('.link').click(function(event) {
    event.preventDefault();
    newLocation = $('.link a').attr("href");
    $('body').fadeOut(1000, newpage);
  });
  function newpage() {
    window.location = newLocation;
  }
});