razekteixeira / Framework7-Plugin-Tour-Guide

A plugin that takes advantage of Framework7 Popover elements to display a tour guide through your application.
30 stars 10 forks source link

Plugin does not accept multiple tours between pages #1

Open DavidGOrtega opened 6 years ago

DavidGOrtega commented 6 years ago

It has a problem with closures.

myApp.onPageInit('page1', function (page) 
{
    var tourSteps = [
    {
        step: 1, 
        header: 'One', 
        message: 'lorem ipsum dolor', 
        element: "body"
    },
    {
        step: 2, 
        header: 'Two', 
        message: 'Lorem ipsum', 
        element: "body"
    }]

    var tourguide = myApp.tourguide(tourSteps, {previousButton: true});  
    tourguide.showTour();
});

myApp.onPageInit('page2', function (page) 
{
    var tourSteps = [
    {
        step: 1, 
        header: 'One', 
        message: 'lorem ipsum dolor', 
        element: "body"
    },
    {
        step: 2, 
        header: 'Two', 
        message: 'Lorem ipsum', 
        element: "body"
    }]

    var tourguide = myApp.tourguide(tourSteps, {previousButton: true});  
    tourguide.showTour();
});
razekteixeira commented 6 years ago

Hi @DavidGOrtega ,

Probably you don't want to instantiate a new "TourGuide" instance for every page.

Please try to do it using a global tour guide instance, and then use that for all instances. I'm almost sure it'll work. ;)

Keep me posted if you can ;)

I'll do my best to upgrade the plugin for the F7v2 as soon as possible.

All the best, César

razekteixeira commented 5 years ago

Hi there @DavidGOrtega ;)

Thanks for the feedback! During May this new version is going to be out :) I'd be happy if you test it :) I'll keep you posted!

Please check the "under development" version of the new plugin.

https://twitter.com/razekteixeira/status/1125154619439702016