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

Addressed issue causing the tour to break when a particular step is missing #24

Open
wants to merge 9 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@tsrivishnu

tsrivishnu commented Jun 8, 2013

Hello.,

Here is my suggested solution for issue #5

As I understood the issue is being caused since you were incrementing the index value when the user tries to go to the next popup. So when a particular step is missing, you are shifting to the DOM order which causes the tour popups to jump around without following a order.

What i have done is, I have taken all the steps indexes for the DOM into an array,

indexes = $elements.map(function(){ return parseInt($(this).attr('data-bootstro-step')) })

and if all the DOM elements are not provided with step, make the order default to follow DOM ordering

defaultOrder = $.grep(indexes, function(x){ return !(isNaN(x)) }).length == 0 ? true : false

So when ever the user tries to go for the next popup, I check over the indexes array to find if the index we are trying is existing, if not, trying for the next available index

nextIndex = function(indexToTry){
    closestIndex = null
    // loop and find the next available value less than or equal to the indexToTry
    $.each(indexes, function(){
       if (parseInt(this) >= parseInt(indexToTry)) {
           closestIndex = this;
           return false;
       }
    });
    return closestIndex;
 }

so it always will find the next available popup and go in a order rather than jumping around when a step is missing.

@clu3

This comment has been minimized.

Show comment
Hide comment
@clu3

clu3 Jun 12, 2013

Owner

@tsrivishnu thanks for the pull request, I will merge it once i've had a closer look.

Owner

clu3 commented Jun 12, 2013

@tsrivishnu thanks for the pull request, I will merge it once i've had a closer look.

@tsrivishnu

This comment has been minimized.

Show comment
Hide comment
@tsrivishnu

tsrivishnu Jun 12, 2013

@clu3 sure.. thanks..

tsrivishnu commented Jun 12, 2013

@clu3 sure.. thanks..

@tsrivishnu

This comment has been minimized.

Show comment
Hide comment
@tsrivishnu

tsrivishnu Sep 2, 2013

@clu3 hey, this has been open for quite a long time.
Let me know if you found any issues with the changes.

tsrivishnu commented Sep 2, 2013

@clu3 hey, this has been open for quite a long time.
Let me know if you found any issues with the changes.

@clu3

This comment has been minimized.

Show comment
Hide comment
@clu3

clu3 Sep 27, 2013

Owner

@tsrivishnu Thanks a lot buddy for reminding. Could you please make it in 1 commit?

Owner

clu3 commented Sep 27, 2013

@tsrivishnu Thanks a lot buddy for reminding. Could you please make it in 1 commit?

TalAter and others added some commits Mar 21, 2013

Passing object into handlers that has the current index in it - passi…
…ng in an object so more can be added later without breaking the API
1. fixed issue #2: Dont always scroll to top, if the element is entir…
…ely visible, do not scroll to top.\n 2. show data can be gotten from ajax to keep HTML clean \n 3. added a few more options: nextButtonText for a simpler nextButton,prevButtonText,finishButtonText. Those attributes can also be overridded by a specific element's corresponding attribute such as data-bootstro-nextButtonText.\n 4. Added a few function handlers in option: onComplete,onExit.\n 5. options.margin added to keep element nicely visible within a some top margin
fixing issue with steps when a intermediate step is missing in the DOM
next popup with check for next available index rather than just incrementing

going to previous popup will also now check for the available previous index rather than just decrementing 1

variable name changed to make it understandable

removed unwanted gitignore
@tsrivishnu

This comment has been minimized.

Show comment
Hide comment
@tsrivishnu

tsrivishnu Sep 28, 2013

@clu3 hey there., I have squashed my four commits into one. You can check. #ec1e022

tsrivishnu commented Sep 28, 2013

@clu3 hey there., I have squashed my four commits into one. You can check. #ec1e022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment