Open brianjessup opened 10 years ago
Also seeing onComplete be completely ignored.
@brianjessup For my purposes, I simply transposed the call to onComplete to the event handler for .bootstro-finish-btn... ln390:
//end of show
$("html").on('click.bootstro', ".bootstro-finish-btn", function(e){
e.preventDefault();
//
if (typeof settings.onComplete == 'function')
settings.onComplete.call(this, {idx : activeIndex});//
//
bootstro.stop();
});
@ericpeters0n nice! Thanks.
I'm not sure if this is a bug or I'm wrong about the intended functionality of the onComplete function.
But when bootstro.next is called, the activeIndex is always 2 less than the count. activeIndex being incremented from 0, and count being the total count. E.g. when I am on step 7 of 8 on your demo page, and click next, the activeIndex = 6 and the count is = 8.
Therefore the onComplete call in the below code is never called.
bootstro.next = function() { if (activeIndex + 1 == count) { if (typeof settings.onComplete == 'function') settings.onComplete.call(this, {idx : activeIndex});// } else { bootstro.go_to(activeIndex + 1); if (typeof settings.onStep == 'function') settings.onStep.call(this, {idx : activeIndex, direction : 'next'});// } };
What confuses me is the "else" statement. Are you intending for the onComplete here to be accesses with a next button located on the last step of the tour? Shouldn't that be an onExit?
What we are trying to use the onComplete for is to flag in our db that the tour has been taken. In that case, the code should read like:
bootstro.next = function() { if (activeIndex + 2 == count) { //call onComplete callback function if needed if (this.onCompleteFunc != undefined) { this.onCompleteFunc.call(this, { idx : activeIndex }); } } bootstro.go_to(activeIndex + 1); if (typeof settings.onStep == 'function') settings.onStep.call(this, {idx : activeIndex, direction : 'next'});// };