我在 Rails 4 应用程序中使用 Bootstrap Tour,使用 Chrome,一切正常,直到我需要在现有模式中运行游览。我正在使用 .click() 来访问模式,但是一旦进入模式,它就不会运行下一步,直到您弹出控制台或控制台已经打开,然后关闭它会恢复游览,跳过一个步骤。
从我一直在阅读的内容来看,它可能是一个 console.log 问题,但我已经删除了控制台这个词的所有用法,但没有任何结果。
下面是运行的 JS 文件,模式内部的位是 view_asset_steps 模块。
//查看资产游览步骤
var view_asset_steps = {
onEnd: function() {
$.cookie("current_tour", "undefined");
},
steps: [
{
path: '/',
element: "#asset-tour-step-one",
title: "Viewing an Asset",
placement: "right",
content: "Clicking anywhere on an asset will allow you to view that asset's details",
},
{
path: '/',
element: ".selected",
title: "Viewing an Asset",
placement: "right",
content: "Clicking anywhere on an asset will allow you to view that asset's details",
onNext: function(tour) {
document.getElementById("view-asset-tour-modal-trigger").click();
}
},
{
path: '/',
element: ".visible",
title:"Different Angles",
placement: "right",
content:"Different angles of the asset you chose will be displayed on the left",
},
{
path: '/',
element: "#view-asset-tour-right",
title:"Other Details",
placement: "left",
content:"All other details will be displayed on the right",
}
]};
//为每次旅行设置一个cookie
$(document).ready(function() {
switch($.cookie("current_tour"))
{
case "focus":
tour = new Tour(focus_steps).init();
break;
case "asset":
tour = new Tour(asset_steps).init();
break;
case "view-asset":
tour = new Tour(view_asset_steps).init();
default:
var tour = new Tour(asset_steps);
}
});
//初始化视图资产游览
$(document).on("click", "#start-view-asset-tour", function(e) {
e.preventDefault();
if ($(this).hasClass("disabled")) {
return;
}
tour = new Tour(view_asset_steps);
$.cookie("current_tour", "view-asset");
tour.init();
tour.restart();
return;
});