本文介绍了结束巡视一次后,使用按钮启动Bootstrap巡视的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的网页,其中包含内容和引导程序,以指导我的网页。

I have a simple web page with content and bootstrap tour to guide through my web page.

我想使用带有以下html代码的按钮来触发游览:

I would like to trigger the tour with a button with following html code:

<button id="initiate_tour" type="button" class="btn btn-danger">Initiate Tour</button>

启动游览的JS如下:

// Instance the tour
var tour = new Tour({
  backdrop: false, 
  storage: false        
});

tour.addSteps([
    {
        element: "#1",
        title: "title1",
        content: "content1"
    },
    {
        element: "#2",
        title: "title2",
        content: "content2"
    },
    {
        element: "#3",
        title: "title3",
        content: "content3"
    },
    {
        element: "#4",
        title: "title4",
        content: "content4"
    }

  ]);

$("#initiate_tour").click(function(){
    // Start the tour
    tour.start();

});

当我点击按钮启动游览时,我可以开始游览。当我点击结束游览按钮时,游览将关闭。但是,当我再次单击启动游览按钮时,游览将无法启动。

I am able to start the tour when I click the button Initiate Tour. When I click End Tour button the tour closes. But when I click the Initiate Tour button again the tour doesn't start.

我已经审核了以下帖子,但没有任何效果:和。

I have refereed following posts but nothing worked:post1 and post2.

请帮助我解决这个问题,因为我是使用javascript和bootstrap之旅的新手

Please help me out solving this as am new to using javascript and bootstrap tour

推荐答案

现在巡演工作正常。我已在启动浏览设置中启用debug为true,以查看浏览器控制台中的日志。我收到错误,上面写着游览结束,初始化被阻止。

Now the tour is working as expected. I have enabled debug as true in bootstrap tour settings to see log in the console of browser. I got error which says "Tour ended, init prevented".

在代码更改后进行:

$("#initiate_tour").click(function(){
    tour.init();
    tour.restart();
});

从以下链接获得解决方案:

Got the solution from following link: problem solution

这篇关于结束巡视一次后,使用按钮启动Bootstrap巡视的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 22:43