Skip to main content
Known Participant
January 19, 2018
Answered

Fade in / Out Script

  • January 19, 2018
  • 1 reply
  • 336 views

Hello All,

I have the below script on each page on my website. So when I select a link to a page, the content gradually appears instead of popping up. It works as expected then I notice if I select the previous page button (all browsers), it brings me back but the content doesn't appear. I have to refresh the browser. Is there a better script that works the same way or a way to edit the existing script so the content appears when I click the previous page button?

  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

  <script>

  jQuery('body').css('display','none');

  jQuery(document).ready(function() {

  jQuery('body').fadeIn();

  jQuery('a').on('click',function(event){

  var thetarget = this.getAttribute('target')

  if (thetarget != "_blank"){

  var thehref = this.getAttribute('href')

  event.preventDefault();

  jQuery('body').fadeOut(function(){

  //alert(thehref)

  window.location = thehref

  });

  }

  });

  });

  setTimeout(function(){

  jQuery('body').fadeIn();

  },1000)

  </script>

    This topic has been closed for replies.

    1 reply

    Nancy OShea
    Community Expert
    Nancy OSheaCommunity ExpertCorrect answer
    Community Expert
    January 19, 2018
    Nancy O'Shea— Product User & Community Expert