Bootstrap Tour不同页面之间的导航问题

时间:2014-04-09 06:49:42

标签: twitter-bootstrap bootstrap-tour

我正在使用bootstrap Tour ..它在Single页面上运行良好,并且在“Next”按钮的帮助下从一个页面(first.html)高效地转到另一个页面(second.html)...问题是,当我按下上一个按钮(在second.html上),它永远不会转到first.html页面..任何帮助解决问题

我的代码在

之下

newly.html(第一页)

<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
    <script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
    <link href="build/css/bootstrap-tour-standalone.min.css" rel="stylesheet" />
    <script src="build/js/bootstrap-tour-standalone.min.js"></script>
    <script src="build/js/Script.js"></script>


    <style>
        .new {
            margin: 20px auto;
            width: 500px;
            padding: 50px;
            background: #EBEBEB;
        }


    </style>
</head>
<body>
    <div id="test" class="new">
        <h1>Header Part</h1>
    </div>

    <div id="test1" class="new">
        <h1>Footer Part</h1>
    </div>


</body>
</html>

mine.html(SecondPage)

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
    <link href="build/css/bootstrap-tour-standalone.min.css" rel="stylesheet" />
    <script src="build/js/bootstrap-tour-standalone.min.js"></script>
    <script src="build/js/Script.js"></script>
    <title>mine</title>
</head>
<body>

    <style>
        .man {
            float: left;
            background: red;
            width: 400px;
        }
    </style>
    <div id="dumy" class="man">
        <h1>This is My Self Made Div</h1>
    </div>
</body>
</html>

的script.js

$(function () {
    var tour = new Tour({
        steps: [
        {
            element: "#test",
            title: "Title of my step",
            content: "This is Header"
        },
        {

            element: "#test1",
            title: "Title of my step",
            content: "This is footer"
        },
        {
            path: "/mine.html",
            element: "#dumy",
            title: "Title of my step",
            content: "I made this step own",
           // backdrop: true

        }
        ]
    });
    // Initialize the tour
    tour.init();

    // Start the tour
    tour.start();
});

1 个答案:

答案 0 :(得分:1)

经过一段时间的快速逻辑思考并花了一天时间,我终于找到了答案...而且只有一行让我整天都陷入困境: :\

编辑第二步或将路径添加到第二步

更新了Script.js

$(function () {
    var tour = new Tour({
        steps: [
        {
            element: "#test",
            title: "Title of my step",
            content: "This is Header"
        },
        {   
            //add path to the second step
            path: "/newly.html",
            element: "#test1",
            title: "Title of my step",
            content: "This is footer"
        },
        {
            path: "/mine.html",
            element: "#dumy",
            title: "Title of my step",
            content: "I made this step own",
           // backdrop: true

        }
        ]
    });
    // Initialize the tour
    tour.init();

    // Start the tour
    tour.start();
});