0

I'm using bootstrap tour, and everything is working fine.

What i'd like to do now, is create a "dismiss for now" button, that should display the tour next time the page is loaded.

In the local storage, when the tour ends, it creates a key called "tour_end" and the value is "yes", so, what i'm trying to do, is to call this:

tour.removeState("tour_end")

so that hopefully, next time the page is loaded, the key is missing and the tour will show up.

Unfortunately, the previous doesn't work, and it returns with this error:

_this.tour.removeState is not a function

any suggestion why this is not working? or the best way to achieve the "dismiss for now" behave?

Thanks a lot

Edit -

I solved this adding localStorage.removeItem("tour_end"); and it seams to work as expected.

Nick
  • 13,493
  • 8
  • 51
  • 98
  • Where did you find the `removeState` method? – Whitebird May 18 '15 at 09:47
  • from here -> https://github.com/usmanhalalit/charisma/blob/master/bower_components/bootstrap-tour/src/coffee/bootstrap-tour.coffee But it is not the official documentation, so i'm not sure it will work, but it's strange that there's no way to remove that value or to have a dismiss for now function – Nick May 18 '15 at 09:49
  • You can call `getCurrentStep()` and save it when dismissing, then when reloading the page call `setCurrentStep(i)` to continue where you left off. – Whitebird May 18 '15 at 09:49
  • the problem wouldn't be that even if i set the current step next time, because of the tour-end it won't show up? – Nick May 18 '15 at 09:51
  • do you think it will break something if i just use localStorage.removeItem("tour_end"); to remove that item? I've just tried and it works, but i'm not sure if this can be a good approach or not.. – Nick May 18 '15 at 09:54
  • As it's a library and it works across multiple platforms, don't look to far into it. The problem is solved and I don't think it's a bad approach. – Whitebird May 18 '15 at 09:55

0 Answers0