Global¶
ZeroClipboard¶
If you are using more multiple ZeroClipboard instances and one of them is placed inside hidden block (with display: none;), make sure to fire up that instance like following:
HTML:
<div class="js-before">
<div data-clipboard-text="First" data-copied-label="First" class="js-click-to-copy">
First element
</div>
</div>
<div class="js-after hidden">
<div data-clipboard-text="Second" data-copied-label="Second" class="js-click-to-copy">
Second element
</div>
</div>
JS:
$(function() {
Talkable.bindClickToCopy('.js-click-to-copy');
var switchBlocks = function() {
$('.js-before, .js-after').toggleClass("hidden");
// Re-init ZeroClipboard instance to refresh tooltip position
Talkable.bindClickToCopy('.js-click-to-copy');
};
});
CSS:
.hidden {
display: none;
}