zurb / joyride

jQuery feature tour plugin.
http://www.zurb.com/playground/jquery-joyride-feature-tour-plugin
1.42k stars 241 forks source link

Pause method instead of pauseAfter #70

Open blanchardjeremy opened 11 years ago

blanchardjeremy commented 11 years ago

I'd really like to do something like this:

        joyrideOptions['postStepCallback'] = function(index, tip) {
            if (index == 1) {
                $(window).joyride("pause");
                fooBar();
                setTimeout(function() {  $(window).joyride("resume"); }, 800 );
            } else if (index == 2) {
                $(window).joyride("pause");
                barBaz();
                setTimeout(function() {  $(window).joyride("resume"); }, 800 );
            } else if (index == 3) {
                $(window).joyride("pause");
                doSomething();
                setTimeout(function() {  $(window).joyride("resume"); }, 800 );
            }
        };

The code is far more readable that way. Could this be implemented without too much trouble? I'm not familiar enough with the codebase to send a pull request.

ehudokai commented 11 years ago

It may be more readable but the complexity is higher since your callback has to get run at every step, where the pauseAfter allows you to stop at specific points without having to run an if each time. (although the if gets run in the code anyway, so I guess its a moot point)

Your code doesn't seem to be really pausing the tour though. It would run exactly the same if you just set the 'timer' setting to 800, and removed your pause and resume calls from your postStepCallback.