How Can I Get A Simple ZeroClipboard Copy-to-clipboard Setup Working Within JQuery On JsFiddle On A Single Click?
I'm struggling to get ZeroClipboard working within a jQuery context. The basic usage I'm after is clipping the text of each div with the class copy on click. The following jsFiddl
Solution 1:
Here is a working solution. On the fiddle I changed client.on('complete'...
to client.on('mouseover'...
to initialize the ZeroClipboard flash file before the first click.
$(document).ready(function() {
ZeroClipboard.config({ moviePath: 'http://zeroclipboard.org/javascripts/zc/ZeroClipboard_1.3.2.swf',debug: true });
var client = new ZeroClipboard($('.copy'));
client.on('load', function(client) {
$('.flash-loaded').text('Flash player loaded at ' + $.now()).fadeIn();
client.on('mouseover', function(client, args) {
client.setText($(this).text());
$('.confirm-copy').text('text copied at ' + $.now()).fadeIn();
});
});
});
Post a Comment for "How Can I Get A Simple ZeroClipboard Copy-to-clipboard Setup Working Within JQuery On JsFiddle On A Single Click?"