我浏览了我的网站。我希望用户可以在结束导览后通过按钮点击手动启动导览。
按钮:
<a href="#" id="tour"><i class=""></i> Start Tour</a>
Bootstrap游览脚本。
<script type="text/javascript">
var tour = new Tour();
tour.addSteps([
{
element: "#step1",
title: "Welcome.",
content: "Welcome to step one.",
placement: "top"
}
]);
tour.addSteps([
{
element: "#step2",
title: "Contact us.",
content: "If you have any questions, please contact us.",
placement: "left"
}
]);
tour.start();
</script>
答案 0 :(得分:3)
这应该就像在JavaScript中的按钮中添加点击事件一样简单。
例如:
$('#tour').click(function(e){
tour.start();
// it's also good practice to preventDefault on the click event
// to avoid the click triggering whatever is within href:
e.preventDefault();
});