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

Enhance the container option #860

Open
Sir-Genius opened this issue Aug 10, 2023 · 6 comments
Open

Enhance the container option #860

Sir-Genius opened this issue Aug 10, 2023 · 6 comments
Labels

Comments

@Sir-Genius
Copy link

It would be fantastic if we could pass a function with a trigger as an argument to the container option:

const clipboard = new ClipboardJS('.js-copy', {
  container: trigger => trigger.closest('.modal')
});
@titanism
Copy link

Going to submit a pull request now for this.

@titanism
Copy link

Well, maybe not, forking isn't working, might be a GitHub outage
Screen Shot 2023-11-10 at 7 24 57 PM

@titanism
Copy link

Related #855

@titanism
Copy link

Also see #388 (comment)

@cderv
Copy link

cderv commented Mar 6, 2024

I believe this would help having one definition of new ClipboardJS('.copy-button', ...) to handle element that are or not in a modal.

Currently, it seems only one specific element can be passed to container - allowing a function would be like target or text and allow more flexibility

@obetomuniz
Copy link
Collaborator

Hey folks, there are some bugs that I will be contributing first to solve, but definitely, after them, I'll be considering all related proposals to triage and potentially work on them, okay? Thank you so much for proposing it.

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

4 participants