Bootstrap Tour Prev按钮不能转到上一页

时间:2014-04-05 11:01:53

标签: javascript jquery html bootstrap-tour

澄清有两页:

  1. index.html (在此页面的帮助下,弹出窗口中的下一个按钮我将移至下面提到的第二页)

  2. product_detail.html (如果我想使用上传按钮返回index.html,则会显示此页面,弹出窗口关闭且没有任何反应)

  3. custom.js的内容:

    var tour = new Tour({
        storage : false,
      steps: [
      {
        element: "#ture-one",
        title: "",
        placement: "bottom",
        content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
      },
      {
        element: "#ture-two",
         title: "",
        placement: "bottom",
        content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
      },
      {
        element: "#ture-three",
        title: "",
        placement: "bottom",
        content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
      },
      {
        element: "#ture-four",
        title: "",
        placement: "bottom",
        content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
      },
      {
        path:"/a/agile_new/product_detail.html",
        element: "#ture-five",
        title: "",
        placement: "left",
        content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
      },
      {
    
        element: "#ture-six",
        title: "",
        placement: "left",
        content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>",
      },
      {
    
        element: "#ture-seven",
        title: "",
        placement: "right",
        content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
      },
      {
    
        element: "#ture-eight",
        title: "",
        placement: "right",
        content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"       
      }
    ]});
    
    
    tour.init();
    
    tour.start();
    

3 个答案:

答案 0 :(得分:2)

根据http://bootstraptour.com/api/,您可以选择在每个步骤中添加路径。您只在最后一步定义了路径。尝试在每个步骤上添加其他属性。

path: "/"

我直接从他们的演示之旅中获取了这段代码。请注意,它们为每个步骤指定路径。

steps: [
  {
    path: "/",
    element: "#demo",
    placement: "bottom",
    title: "Welcome to Bootstrap Tour!",
    content: "Introduce new users to your product by walking them through it step by step."
  }, {
    path: "/",
    element: "#usage",
    placement: "top",
    title: "A super simple setup",
    content: "Easy is better, right? The tour is up and running with just a few options and steps."
  }, {
    path: "/",
    element: "#license",
    placement: "top",
    title: "Best of all, it's free!",
    content: "Yeah! Free as in beer... or speech. Use and abuse, but don't forget to contribute!"
  }, {
    path: "/api",
    element: "#options",
    placement: "top",
    title: "Flexibilty and expressiveness",
    content: "There are more options for those who want to get on the dark side.<br>\nPower to the people!",
    reflex: true
  }, {
    path: "/api",
    element: "#duration",
    placement: "top",
    title: "Automagically expiring step",
    content: "A new addition: make your tour (or step) completely automatic. You set the duration, Bootstrap\nTour does the rest. For instance, this step will disappear in <em>5</em> seconds.",
    duration: 5000
  }, {
    path: "/api",
    element: "#methods",
    placement: "top",
    title: "A new shiny Backdrop option",
    content: "If you need to highlight the current step's element, activate the backdrop and you won't lose\nthe focus anymore!",
    backdrop: true
  }, {
    path: "/api",
    element: "#reflex",
    placement: "bottom",
    title: "Reflex mode",
    content: "Reflex mode is enabled, click on the text in the cell to continue!",
    reflex: true
  }, {
    path: "/api",
    title: "And support for orphan steps",
    content: "If you activate the orphan property, the step(s) are shown centered in the page, and you can\nforget to specify element and placement!",
    orphan: true,
    onHidden: function() {
      return window.location.assign("/");
    }
  }
]

您可以为步骤提供大量不同的选项。注意上面的最后一步。 onHidden:它可以带你到任何你喜欢的地方。在这种情况下,回到家里。 &#34; /&#34;

path: "",
  element: "",
  placement: "right",
  title: "",
  content: "",
  next: 0,
  prev: 0,
  animation: true,
  container: "body",
  backdrop: false,
  redirect: true,
  reflex: false,
  orphan: false,
  template: "",
  onShow: function (tour) {},
  onShown: function (tour) {},
  onHide: function (tour) {},
  onHidden: function (tour) {},
  onNext: function (tour) {},
  onPrev: function (tour) {},
  onPause: function (tour) {},
  onResume: function (tour) {}

我希望这会对你有所帮助。

答案 1 :(得分:2)

请查看更新的脚本文件......它在我的方面工作正常

$(function () {

    var tour = new Tour({

        steps: [
        {
            element: "#ture-one",
            title: "s",
            placement: "bottom",
            content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>",
            duration:5000
        },
        {
            element: "#ture-two",
            title: "",
            placement: "bottom",
            content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>",
            duration: 6000
        },
        {
            element: "#ture-three",
            title: "",
            placement: "bottom",
            content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>",
            duration: 7000
        },
        {
            path:"/index.html",
            element: "#ture-four",
            title: "",
            placement: "bottom",
            content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>",
            duration: 7000
        },
      {
          path:"/product.html",
          element: "#ture-five",
          title: "",
          placement: "left",
          content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>",
          duration: 7000
      },
      {

          element: "#ture-six",
          title: "",
          placement: "left",
          content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>",
          duration: 7000
      },
      {

          element: "#ture-seven",
          title: "",
          placement: "right",
          content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"
      },
      {

          element: "#ture-eight",
          title: "",
          placement: "right",
          content: "<p>This is the Deployment Manager Dashboard.</p><p>It shows you which versions of your software are deployed to your different environments.</p>"       
      }
        ]});


    tour.init();

    tour.start();
});

答案 2 :(得分:1)

有一个&#34;奇怪的&#34;这样做的方式。我不是自助游的用户,但你可以推进历史记录吗?

var stateObj = { foo: "bar" }; history.pushState(stateObj, "page 2", "bar.html")

或使用localStorage按用户存储最后一页