Home » Jquery » Browser back button is not working while applying page transition effect in jQuery-Exceptionshub

Browser back button is not working while applying page transition effect in jQuery-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

I am using page transition for my website. When goto other pages transition effect applies. While doing this browser back button is not working. I have pasted the jQuery code used for transition effect.

<script>
    $(document).ready(function() {
            $("a").click(function() {
              $link = $(this).attr("href");
              $("body").fadeOut(500);
              setTimeout(function() {
                window.location.replace($link);
              }, 500);
              return false;
            });
     });
</script>
How to&Answer:

Hope this help you.

$(document).ready(function() {
        $("a").click(function() {
          $link = $(this).attr("href");
          $("body").fadeOut(500);
          setTimeout(function() {
              console.log($link);
            window.location = $link;
          }, 500);
          return false;
        });
 });