3

I am using intro.js to create a small intro to my website. I want The tour to go from page 1(home)-2(another page) and then back to 1(home).

I have suscsesfully got it going from page 1-2 but am unsure about how to get it to return to page 1. I am very unskilled in javascript so it is probably an easy solution but the ones I have found online don't work.

Codedealing with page switching:

Home

<script type="text/javascript" src="js/intro.js"></script>
    <script type="text/javascript">
      document.getElementById('startButton').onclick = function() {
        introJs().setOption('doneLabel', 'Next page').start().oncomplete(function() {
          window.location.href = '../mtcook/mtcook.html?multipage=true';
        });
      };
    </script>

2nd Page(called mtcook):

 <script type="text/javascript" src="js/intro.js"></script>
    <script type="text/javascript">
      if (RegExp('multipage', 'gi').test(window.location.search)) {
        introJs().start();
      }
      </script>
Jonathan Allard
  • 18,429
  • 11
  • 54
  • 75
user1993
  • 33
  • 3

1 Answers1

1

In the 2nd page couldn't you do what you did in the first page, so something like this:

 <script type="text/javascript" src="js/intro.js"></script>
    <script type="text/javascript">
      if (RegExp('multipage', 'gi').test(window.location.search)) {
        introJs().setOption('doneLabel','Next page').start().oncomplete(function() {
          window.location.href = '../mtcook/index.html' // or whatever your original page is
        });
      }
      </script>
Carl
  • 5,569
  • 6
  • 39
  • 74