IGreatlyDislikeJavascript / bootstrap-tourist

Quick and easy way to build your product tours with Bootstrap Popovers for Bootstrap 3 and 4. Based on Bootstrap-Tour, but with many fixes and features added.
63 stars 36 forks source link

Won't jump to next step when modal hidden. Fixed! #33

Closed eformx closed 5 years ago

eformx commented 5 years ago

Great mods to orig plugin; but couldn't get it to jump to the next step when a modal was hidden. Noticed that the onModalHidden logic was not correct and flipped the methods around. If it was the last step then hide (not goto the next), and if there is a next step goto next (not end). This fixes the plugin.

$_modalObject.off("hidden.bs.modal", funcModalHelper);

if (_this._isLast())
{
//return _this.next();
 return _this.end();

}
else
{
 //return _this.end();
 return _this.next();
}
IGreatlyDislikeJavascript commented 5 years ago

Thanks for your contribution and finding this!

You've actually found 2 bugs, I need to look into this a bit more. _isLast() should return true if current step is the last step in the tour, however the code in that function is wrong and returns the reverse result!

So there's something not quite right here. Leave this one with me :-)

ibastevan commented 5 years ago

To get mine working i added a couple of click functions inside the onNext, onPrev and onShown and seems to work quite well now if you need a workaround for the time being.

onNext: function (tour) {
    $("#modalID .modal-footer input[type='submit']").click();
},
onPrev: function (tour) {
    $('#modalID').modal('hide');
},
onShown: function (tour) {                      
    $('#modalID .modal-footer button[data-dismiss="modal"]').click(function () {
        tour.goTo(3);
        return false;
    });
},
onHidden: function (tour) {
    $('#modalUserPortfolio').modal('hide');
},

It seems to go to the next step quite well when you cancel or submit in your modal, although has a small delay. When someone hits the submit button on my modal i have the page refresh and it will skip the modal step and load up the next step.

IGreatlyDislikeJavascript commented 5 years ago

I think I've fixed this isLast problem, but I've done it in the unstable/new-backdrop branch for now. It needed a few changes but we're almost ready to move the unstable branch to the master branch so I'll wait until then to push an update to master, and then close this afterwards.

Thanks for your updates and contributions guys!

IGreatlyDislikeJavascript commented 5 years ago

v0.3.0 uploaded into master branch, this issue should be fixed.