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 load a predefined element with an id in Dom with mui overlay? #45

Closed
mukuljp opened this issue Sep 18, 2015 · 3 comments
Closed
Labels

Comments

@mukuljp
Copy link

mukuljp commented Sep 18, 2015

Currently new element is created on each overlay initialisation , instead i want show existing single div on every overlay call, is there any option in mui so that we can pass the id or class

@amorey
Copy link
Member

amorey commented Sep 18, 2015

If you keep the reference to your element, you should be able to use the same element on every overlay call:

<script>
  // initialize modal element
  var modalEl = document.createElement('div');
  modalEl.style.width = '400px';
  modalEl.style.height = '300px';
  modalEl.style.margin = '100px auto';
  modalEl.style.backgroundColor = '#fff';

  function activateModal() {
    // show modal
    mui.overlay('on', modalEl);
  }
</script>
<button class="mui-btn mui-btn-primary" onclick="activateModal()">Activate modal</button>

Let me know if that solves your problem.

@amorey
Copy link
Member

amorey commented Sep 19, 2015

@mukuljp Did that code snippet help to solve your problem?

@mukuljp
Copy link
Author

mukuljp commented Sep 21, 2015

yes ,that solved the issue, thank you@amorey

@mukuljp mukuljp closed this as completed Sep 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants