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

Destroy BigPicture #44

Closed
jantimon opened this issue Jun 29, 2020 · 2 comments
Closed

Destroy BigPicture #44

jantimon opened this issue Jun 29, 2020 · 2 comments

Comments

@jantimon
Copy link

Hey,

thanks for this lightweight simple image modal plugin 👍
Is there any way to close the current open image and remove all memory allocations?

@henrygd
Copy link
Owner

henrygd commented Jun 29, 2020

Hi there,

This isn't in the readme yet because I've been lazy about updating it, but as of 2.5.0 you can do this:

// assign to a variable
let bp = BigPicture({
	el: e.target,
	imgSrc: 'https://yourimage.jpg',
})

// close
bp.close()

It just exposes the normal close function inside BigPicture which clears out the dom and removes any newly created elements.

Does that work for you?

@jantimon
Copy link
Author

jantimon commented Jul 1, 2020

Cool thanks 👍

@henrygd henrygd closed this as completed Jul 1, 2020
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

2 participants