0

I am uisng bootstraptour.com for multipages tour.

I have separate demo.js which contain all code and included in all two page.

when i click on take a tour button it strat tour and when it redirect next.php it not show any more step.

when i am redirect to another page it stop to show next step.

it stop tour.

how can i fix this multipage tour.

Code

$(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();
    }
});
});
benomatis
  • 5,536
  • 7
  • 36
  • 59
Nilesh patel
  • 1,216
  • 2
  • 14
  • 38

1 Answers1

1

Your tour starts only when the '#taketour' element is clicked. When you move on to the next page, the tour hasn't started yet. Hence you dont see it on screen as well.

You may well have to do something like this,

if(tour.started() && !tour.ended())
    {
        tour.init();
        tour.start();
    }

to check if the tour has not ended and hence start the tour from where you left off in the previous page. This obviously will work only if you haven't set storage:false when creating a new tour.

Sunil
  • 3,424
  • 2
  • 24
  • 25