我在我的网站和this fiddle中设置了以下非常简单的演示。它实际上与the official demo相同。在任何情况下我都不会游览。我想念什么?
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-tour/0.8.1/css/bootstrap-tour.min.css">
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script type='text/javascript' src='http://code.jquery.com/jquery-git.js'></script>
<script type='text/javascript' src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script type='text/javascript' src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-tour/0.8.1/js/bootstrap-tour.min.js"></script>
<button class="btn" id="tour-go">Start the tour!</button>
<form>
<input id="one" value="one" />
<input id="two" value="two" />
<input id="three" value="three" />
</form>
$(function () {
var tour = new Tour({
steps: [{
element: "#one",
title: "Title of my step",
content: "Content of my step"
}, {
element: "#two",
title: "Title of my step",
content: "Content of my step"
}, {
element: "#three",
title: "Title of my step",
content: "Content of my step"
}]
});
// Initialize the tour
tour.init();
$('#tour-go').click(function () {
// Start the tour
tour.start();
});
});
最佳答案
您正在使用bootstrap-tour v0.8.1,因此您的代码不正确,正确的代码是:
var tour = new Tour() ;
tour.addSteps([{
element: "#one",
title: "Title of my step",
content: "Content of my step"
}, {
element: "#two",
title: "Title of my step",
content: "Content of my step"
}, {
element: "#three",
title: "Title of my step",
content: "Content of my step"
}]) ;
这个小提琴正在工作:http://jsfiddle.net/9LcQx/
关于jquery - Bootstrap Tour无法开始,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23569338/