Bootstrap之旅不起作用

时间:2016-11-14 07:34:11

标签: javascript html css twitter-bootstrap bootstrap-tour

我正在测试Bootstrap Tour,我已经设置了一个非常简单的测试页面。内容显示但旅行功能由于某种原因没有启动。有人能告诉我,我可能做错了吗?

谢谢:)

请在下面找到我的代码

<html>

<head>
    <meta charset="utf-8">
    <title> This is a testing page for bootstrap tour </title>

    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="../bootstraptour/build/css/bootstrap-tour.min.css" rel="stylesheet">
    <link href="../bootstraptour/build/css/bootstrap-tour-standalone.min.css" rel="stylesheet">

</head>


<!-- Bootstrap core JavaScript
  ================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../bootstrap/js/jquery.min.js"></script>
<script src="../bootstrap/js/bootstrap.min.js"></script>
<script src="../bootstraptour/build/js/bootstrap-tour.min.js"></script>
<script src="../bootstraptour/build/js/bootstrap-tour-standalone.min.js"></script>

<script>
    var tour = new Tour();

    // Add your steps. Not too many, you don't really want to get your users sleepy
    tour.addSteps([{
        element: "#content", // string (jQuery selector) - html element next to which the step popover should be shown
        title: "Title of my step", // string - title of the popover
        content: "Content of my step" // string - content of the popover
    }, {
        element: "#content1",
        title: "Title of my step",
        content: "Content of my step"
    }]);

    // Initialize the tour
    tour.init();

    // Start the tour
    tour.start();
</script>


<body>
    <div id="content">
        Hello, World!
    </div>
    <br>
    <br>
    <br>
    <div id="content1">
        Another Hello, World!
    </div>
</body>

</html>

2 个答案:

答案 0 :(得分:1)

您应该 bootstrap-tour.min.css/bootstrap-tour.min.js(当您自己包括bootstrap.min.css/bootstrap.min.js时)或bootstrap-tour-standalone.min.css/bootstrap-tour-standalone.min.js,但不应包括两者。请参阅bootstrap tour homepage上的说明。

这是一个工作片段:

var tour = new Tour();

// Add your steps. Not too many, you don't really want to get your users sleepy
tour.addSteps([{
  element: "#content", // string (jQuery selector) - html element next to which the step popover should be shown
  title: "Title of my step", // string - title of the popover
  content: "Content of my step" // string - content of the popover
}, {
  element: "#content1",
  title: "Title of my step",
  content: "Content of my step"
}]);

// Initialize the tour
tour.init();

// Start the tour
tour.start();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tour/0.11.0/js/bootstrap-tour-standalone.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tour/0.11.0/css/bootstrap-tour-standalone.min.css" rel="stylesheet"/>

<div id="content">
  Hello, World!
</div>
<br>
<br>
<br>
<div id="content1">
  Another Hello, World!
</div>

答案 1 :(得分:0)

您需要清除本地存储,因为引导浏览正在使用localStorage。