Intro.js 2 pages then return to home

懵懂的女人 提交于 2019-12-12 16:19:55

问题


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>

回答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>


来源:https://stackoverflow.com/questions/39011744/intro-js-2-pages-then-return-to-home

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!