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:
- function slideSwitch() {
- var $active = $('#slideshow img.active');
- if($active.length == 0) $active = $('#slideshow img:last');
- var $next = $active.next().length ? $active.next() : $('#slideshow img:first');
- $active.addClass('last-active');
- $next.css({
- opacity: 0.0
- }).addClass('active').animate({
- opacity: 1.0
- }, 1500, function () {
- $active.removeClass('active last-active');
- });
- }
- $(function () {
- setInterval("slideSwitch()", 10000);
- });
- <div id="nav">
- <ul>
- <li>
- <a href="">RM</a>
- </li>
- <div class="diagonal"></div>
- <li>
- <a href="">Offerte</a>
- </li>
- <div class="diagonal"></div>
- <li>
- <a href="">Contact</a>
- </li>
- </ul>
- </div>
- <div id="slideshow">
- <img src="img/Route 163.jpg" alt="Slideshow Image 1" class="active">
- <img src="img/Spring.jpg" alt="Slideshow Image 2">
- <img src="img/Road to America.jpg" alt="Slideshow Image 3">
- <img src="img/Kopenhagen.jpg" alt="Slideshow Image 4">
- </div>