1

I have a bootstrap tour and when I do click on 'skip' I want close the popover but not end the tour, when I click at the visitbutton I want continue by the last step before closed, how I do that?

The button:

<button class='btn btn-default' data-role='end'>${skip}</button>

Code:

define(function () {
    var tourElement = function getTourElement(tour){
        return tour._options.steps[tour._current].element
    };

    var getConfig = function (tourSteps) {
        return {
            name: "virtual-visit",
            container: "body",
            keyboard: true,
            storage: window.localStorage,
            debug: true,
            backdrop: true,
            backdropContainer: "body",
            backdropPadding: 0,
            orphan: true,
            duration: false,
            steps: tourSteps
            onShown: function(tour) {
                var stepElement = tourElement(tour);
                $(stepElement).after($('.tour-step-background'));
                $(stepElement).after($('.tour-backdrop'));
            },
            onStart: function(tour) {
                $('body').addClass('on-tour');
            },
            onEnd: function(tour){
            }
        };
    };

    var run = function (tourSteps) {
        if ( $(window).width() > 1024 ) {
            tour = new Tour( getConfig( tourSteps ) );
            tour.restart();
            tour.init();
            tour.start();
        }
    };

    return {
        run: run,
        getConfig: getConfig
    };
});

Thanks.

1 Answers1

0

Just use :

tour.end()

to stop the "tour"

and then use :

tour.start(true)

to force it to start, it will automatically resume at the step where it was stopped

Hassan ALAMI
  • 318
  • 1
  • 5
  • 18
  • I'm using the fork `IGreatlyDislikeJavascript/bootstrap-tourist` and call `.end()` on a tour. When I call `.start()` again, I get the message: `Tour previously ended, exiting. Call tour.restart() to force restart`. I want to find out if there is a tour to continue and start it where it was left and if there's none I'd like to restart a new tour. – Bernhard Döbler May 02 '19 at 15:54