EragonJ / Trip.js

🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.
https://eragonj.github.io/Trip.js/
MIT License
793 stars 111 forks source link

Customize tripBlockHTML for each step? #152

Closed olso closed 8 years ago

olso commented 8 years ago
function configureOnboarding() {
    var options = {
        overlayHolder: '#accountsView',
        tripTheme: 'white'
    };

    var steps = [
        // Add first account
        {
            sel: '.accountsBottom',
            content: '<div>To add your first account, please click the Add account button</div>',
            tripBlockHTML: [
                '<div class="trip-block">',
                '<div class="trip-content"></div>',
                '<a href="#" class="trip-close"></a>',
                '<a href="#" class="trip-prev"></a>',
                '<a href="#" class="trip-next"></a>',
                '</div>'
            ]
        }
    ];

    onboarding = new Trip(steps, options);
    onboarding.start();
}
EragonJ commented 8 years ago

Well, I don't think this is a good way. When Trip.js got initialized, we'll do the check and make sure APIs/ or events are bound to the right component and this will only happened once.

One question, why you need to do that by the way ? Why not just use multiple instances of Trip.js ? The reason why Trip is made like a Class is to let you have the flexibilities to do complex interactions. With onTripChange or some events, I think you can still make the same thing which you want.

EragonJ commented 8 years ago

@olso feel free to discuss more if you want. I'll close this issue first :) Thanks