Skip to content
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

How to control stack order of modals that are dynamically loaded #46

Closed
djsmith42 opened this issue Jan 1, 2013 · 2 comments
Closed

Comments

@djsmith42
Copy link

This is more of a question than an issue.

I am using AngularJS's ng-include directive to download a few modals from the server. I am then showing/hiding them with $.modal('show') and $.modal('hide'). It seems that the stack order is random. I cannot seem to influence it with z-index, tabindex, or anything else.

What controls the stacking order of modals as they are hidden and shown?

@djsmith42
Copy link
Author

P.S. My modal HTML fragments are downloaded in a seemingly random order. Is there a way to tell bootsrap-modal that I want their stack order to be a certain way, regardless of the order in which they are loaded into the DOM?

@djsmith42
Copy link
Author

I think I have resolved my issue. I was calling $.modal('hide') on all my modals, and the order was non-deterministic. In reading the bootstrap-modal code, I realize that it pushes all modals onto its stack as they are initialized, even if they are just hidden. In my situation, the order was random. I have changed my code to not call $.modal() until the user actually clicks. That way, the stack order is correct for my application.

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

No branches or pull requests

1 participant