我正在使用bootstraptour.com进行多页游览。
我有单独的demo.js,其中包含所有的代码,并包括在所有两个页面。
当我点击take a tour按钮时它开始tour当它重定向next。php时它不再显示任何步骤
当我重定向到另一个页面时,它停止显示下一步。
it stop tour.
我该如何修复这个多页的游览。
$(function(){
var $demo, duration, remaining, tour;
$demo = $("#taketour");
storage:false,
duration = 5000;
remaining = duration;
tour = new Tour({
// //storage : false,
// onStart: function() {
// ///return $demo.addClass("disabled", true);
// },
// onEnd: function() {
// return $demo.removeClass("disabled", true);
// },
debug:true,
name: "tour"
}).init();
tour.addSteps([
{
//path:"home.php",
element: "#a",
placement: "right",
title: "step1 ",
content: "1"
},
{
element: "#b",
placement: "right",
title: "s2",
content: "c2"
},
{
path:'next.php'
element: "#na",
placement: "bottom",
title: "na1",
content: "na1"
},
{
element: "#nat",
placement: "bottom",
title: "na2",
content: "na2"
}
]);
$("#taketour").click(function(e){
e.preventDefault();
console.log("call tour");
// if ($(this).hasClass("disabled")) {
// return;
// }
tour.restart();
if (tour.ended()) {
console.log("tour end");
tour.restart();
}
});
});
当'#taketour'元素被点击时,您的旅行才开始。当你转到下一页时,旅程还没有开始。因此你也不会在屏幕上看到它。
你很可能不得不这样做,
if(tour.started() && !tour.ended())
{
tour.init();
tour.start();
}
检查游览是否没有结束,然后从上一页停止的地方开始游览。显然,只有当在创建新tour时没有设置storage:false时,这才有效。