zeroclipboard fire click event via jquery

只谈情不闲聊 提交于 2019-12-06 01:22:35

The newest versions of ZeroClipboard have done away with Client(). Hence the code changes a bit too. Download the latest version from Github here

Also then say you want to update/put some string when page/element loads. Say on clicking the 'element' having id '#id', the clipboard needs to be loaded with some text

<script>
var str = 'Some text';
$('element').attr('data-clipboard-text','str');
ZeroClipboard.setDefaults({moviePath:'http://...../ZeroClipboard.swf'});
var clip = new ZeroClipboard($('#id'));
clip.on('complete',function(client, args){
alert('Copied');
});
</script>

Hope this helps

Unfortunately you can't simulate a click on the flash object, and have it setData in the clipboard http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Clipboard.html#. It's a security precaution by Adobe.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!