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

Modal hide & destruction #40

Closed
5AMSolutions opened this issue Dec 10, 2012 · 2 comments
Closed

Modal hide & destruction #40

5AMSolutions opened this issue Dec 10, 2012 · 2 comments

Comments

@5AMSolutions
Copy link

Could more documentation or examples be provided? I ask because it seems that modals continue to hang around within the DOM despite execution of the Modal.destroy()

@jschr
Copy link
Owner

jschr commented Dec 10, 2012

The destroy method will return the element to it's "pre-modaled" state. So if the element existed in the DOM tree before being modaled, it will be moved back there. If you are modaling a dynamically created element meaning it has no parent in the DOM tree, it should be removed from the document.

If you are dynamically generating the modal element and then appending it to the DOM each time, that could explain why you are seeing them not being destroyed.

var $modal = $('<div class="modal">');
...
$modal
    .appendTo('body')
    .modal()

In this case the appendTo is not necessary and will cause a modal to be created for each launch.

Hope that helps

@jschr
Copy link
Owner

jschr commented Dec 17, 2012

Will assume that this was resolved. Will reopen if necessary.

@jschr jschr closed this as completed Dec 17, 2012
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