Intro.js 2页,然后返回首页 [英] Intro.js 2 pages then return to home

查看:73
本文介绍了Intro.js 2页,然后返回首页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 intro.js 为我的网站创建一个小型介绍.我希望游览从第1页(首页)-2(另一页)开始,然后回到1(首页).

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).

我从1-2页成功地获取了它,但不确定如何使其返回第1页.我对javascript非常不熟练,因此这可能是一个简单的解决方案,但是我在网上找到的解决方案却不行工作.

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.

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

第二页(称为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>

推荐答案

在第二页中,您无法完成第一页中的操作,因此是这样的:

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>

这篇关于Intro.js 2页,然后返回首页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆