Skip to content
New issue

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

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

Already on GitHub? # 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
Choose a base branch
from

Conversation

tsrivishnu
Copy link

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
Copy link
Owner

clu3 commented Jun 12, 2013

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

@tsrivishnu
Copy link
Author

@clu3 sure.. thanks..

@tsrivishnu
Copy link
Author

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

@clu3
Copy link
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 9 commits September 28, 2013 15:06
…ng in an object so more can be added later without breaking the API
…ntirely 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
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
Copy link
Author

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

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

Successfully merging this pull request may close these issues.

5 participants