mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Container option (#368)
* Allow container option to fix bugs related to bootstrap modals etc. * Updated readme to reflect addition of container option * Name link * Removed test log * Remove unwanted whitespace * Refactored description
This commit is contained in:
committed by
Zeno Rocha
parent
4065080a17
commit
f42b57067d
@@ -145,6 +145,15 @@ new Clipboard('.btn', {
|
||||
});
|
||||
```
|
||||
|
||||
For use in bootstrap modals or with any other library that changes the focus you'll want to set the focused element as the `container` value.
|
||||
See [Issue #155 (comment)](https://github.com/zenorocha/clipboard.js/issues/155#issuecomment-273124130)
|
||||
|
||||
```js
|
||||
new Clipboard('.btn', {
|
||||
container: document.getElementById('#modal')
|
||||
});
|
||||
```
|
||||
|
||||
Also, if you are working with single page apps, you may want to manage the lifecycle of the DOM more precisely. Here's how you clean up the events and objects that we create.
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user