如何使页面重定向在引导浏览中的下一个按钮单击上起作用

时间:2019-02-07 01:04:52

标签: html laravel bootstrap-tour

当任何用户登陆页面时,他应该看到如下所示的第一步,然后单击下一步按钮,他应该在我希望向其发送用户的下一页上重定向,但并非如此。

在这里,当我尝试执行多步操作时,即在着陆时向用户显示一些数据,然后在下一步中,我重定向页面,然后该页面就可以正常工作,但仅适用于单步操作,

我正在使用最新版的引导浏览文件,即昨天从其官方网站下载的文件。

请参见下面的代码:-

var tour = new Tour({
            steps: [
                /*  {
                    element: "#site-tour-1-1",
                    title: "1",
                },*/ 
                {
                    element: "#site-tour-1-1",
                    title: "Search any business by typing initials",
                    //path: "/index2.html",
                    multipage: true,
                    onNext: function() {
                        window.location = "/index2.html"
                    }
                }     
            ],
            debug: true,
            backdrop: true,
            redirect:false,
            storage: window.localStorage,
            template: " <div class='popover tour'><div class='arrow'></div><h3 class='popover-title'></h3><div class='popover-content'></div><div class='popover-navigation'><button class='btn btn-default' data-role='prev'>« Prev</button>&nbsp;&nbsp;</span><button class='btn btn-default' data-role='next'>Next »</button><button class='btn btn-default end-tour' data-role='end'>End tour</button></div></div>",

        });
        tour.init();
        tour.restart();

1 个答案:

答案 0 :(得分:0)

就像在bootstrap-tour的文档中所说,您可以通过在步骤之一中添加字段“ path”来管理多页浏览。 (请参见此处:http://bootstraptour.com/api/#multipage

在您的情况下,您应该这样做:

var tour = new Tour({
        steps: [
            {
                element: "#site-tour-1-1",
                title: "Search any business by typing initials",
            },
            {
                element: "#site-tour-1-2",
                title: "This is my second step";
                path: "/index2.html"
            }
        ],
        debug: true,
        backdrop: true,
        storage: window.localStorage,
        template: " <div class='popover tour'><div class='arrow'></div><h3 class='popover-title'></h3><div class='popover-content'></div><div class='popover-navigation'><button class='btn btn-default' data-role='prev'>« Prev</button>&nbsp;&nbsp;</span><button class='btn btn-default' data-role='next'>Next »</button><button class='btn btn-default end-tour' data-role='end'>End tour</button></div></div>",

    });
    tour.init();
    tour.restart();

让我知道它是否对您有帮助。