Keep sliding when click to other page

Keep sliding when click to other page

I've made a full background slider, but when I click on a menu-item the slider starts over from the first image. Is it possible that if I click on a menu-item (to another page) that the slider keeps sliding?

Here is the code:

  1. function slideSwitch() {
  2. var $active = $('#slideshow img.active');
  3. if($active.length == 0) $active = $('#slideshow img:last');
  4. var $next = $active.next().length ? $active.next() : $('#slideshow img:first');
  5. $active.addClass('last-active');
  6. $next.css({
  7. opacity: 0.0
  8. }).addClass('active').animate({
  9. opacity: 1.0
  10. }, 1500, function () {
  11. $active.removeClass('active last-active');
  12. });
  13. }
  14. $(function () {
  15. setInterval("slideSwitch()", 10000);
  16. });


  1. <div id="nav">
  2. <ul>
  3. <li>
  4. <a href="">RM</a>
  5. </li>
  6. <div class="diagonal"></div>
  7. <li>
  8. <a href="">Offerte</a>
  9. </li>
  10. <div class="diagonal"></div>
  11. <li>
  12. <a href="">Contact</a>
  13. </li>
  14. </ul>
  15. </div>
  16. <div id="slideshow">
  17. <img src="img/Route 163.jpg" alt="Slideshow Image 1" class="active">
  18. <img src="img/Spring.jpg" alt="Slideshow Image 2">
  19. <img src="img/Road to America.jpg" alt="Slideshow Image 3">
  20. <img src="img/Kopenhagen.jpg" alt="Slideshow Image 4">
  21. </div>