Copy & open script for couponsites (zeroclipboard)
Copy & open script for couponsites (zeroclipboard) simple method
HTML
<script src="http://zeroclipboard.org/javascripts/zc/ZeroClipboard_1.3.3.js"></script>
<div class="copy">Click this text to copy this text</div>
<div class="copy">Or click this text to copy this text</div>
<p class="debug flash-loaded">Flash player is loaded.</p>
<p class="debug confirm-copy">Text Copied.</p>
<textarea placeholder="Use this textarea to test your clipboard"></textarea>
CSS
body {margin:10px;}
.copy {border:1px solid #ccc; background:yellow; padding:5px; margin:10px;}
.debug {display:none; color:#aaa; margin:10px;}
textarea {margin:10px;}
JavaScript
$(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();
});
});
});