Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tour.init() appears unnecessary #700

Open
beard7 opened this issue Aug 31, 2018 · 2 comments
Open

tour.init() appears unnecessary #700

beard7 opened this issue Aug 31, 2018 · 2 comments

Comments

@beard7
Copy link

beard7 commented Aug 31, 2018

The documentation states that init() needs to be called before start(), but as far as I can tell, this is unnecessary: the tour starts perfectly well by just calling start() or restart()

I discovered this is after I removed tour.init() because I was getting an error: Cannot read property 'backdrop' of undefined

Removing tour.init() fixes the error and has no negative consequences.

@gfruleux
Copy link

gfruleux commented Nov 20, 2018

The documentation is correct if you depend on some functions of the Tour before starting it (exemple of getCurrentStep which will be null if you skip the init)
But yeah, the tour can start without init because init is called from start if not initialised.

Edit: I knew I missed something ! I removed the following block from the Init method to keep it to initialisation

if (this._current !== null) {
    this.showStep(this._current);
}

IGreatlyDislikeJavascript added a commit to IGreatlyDislikeJavascript/bootstrap-tour that referenced this issue Nov 28, 2018
… added

Fixed flow issue with tour.init() especially where page contains hidden elements
- Do not call tour.init(). Create your new Tour({options}); then call Tour.start or .restart when you want to show the tour. (sorich87#700 


Fixed inefficient display of tour popover
- popovers do not constantly reload current step on scroll. Flickering/flashing resolved. (sorich87#685)
- element popovers don't move around the page as you scroll - this is a personal thing, but I didn't like the functionality where if you scroll the page so the element is no longer visible, the popover follows you around. Doesn't make much sense because the popover isn't visually attached to it's parent element. 
- orphan popovers stay stuck to the center of the screen no matter what


Added onElementUnavailable(tour, step) to global and step options
- Specify a function as normal (i.e.: same as onNext etc) with pattern above. Function will be called when the element of the step is unavailable == missing, hidden etc. "step" parameter indicates the step that is going to be skipped.


Added progress indicators and ability to dynamically change during tour:
- Global option "showProgressBar" : set to true to show a (bootstrap) progress bar, or false to hide it
- Step option "showProgressBar" will override global option, so you can turn on/off progress bars per step

Customise the progress bar using option getProgressBarHTML:
getProgressBarHTML: function(percentProgress) { return '<div class="progress"><div class="progress-bar progress-bar-striped" role="progressbar" style="width: ' + percentProgress + '%;"></div></div>'}


- Global and step option "showProgressText" shows a "N / X" tour step counter in the popover title bar

Customise the text using option getProgressTextHTML:
getProgressBarHTML: function(stepNumber, percentProgress, stepCount) { return '<span class="pull-right">' + stepNumber + '/' + stepCount + '</span>'; }

Based on sorich87#362
@IGreatlyDislikeJavascript

Doing this does have a negative consequence - it prevents multi page tours, or tours from continuing at previous step after page reload.

My fork fixes this problem. Use my fork, do not call init(). Call start() to begin the tour OR to resume tour from last viewed step. Call restart() to start the tour from first step.

#710

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants