How to actually use ZeroClipboard in jQuery?

后端 未结 4 847
天命终不由人
天命终不由人 2020-12-17 17:01

I just can\'t get this thing. How is ZeroClipboard supposed to work? Why does it need to move the flash-element over the copied text?

I\'ve read this thing: http://c

4条回答
  •  误落风尘
    2020-12-17 17:41

    The current version of ZeroClipboard actually contains a bug that would cause an JS error using the script suggested by JacobM - in the following scenario:

    1. Create a reference to the ZeroClipboard.Client() returned from the new constructor. (e.g. var clip = new ZeroClipboard.Client();)
    2. Set the text by doing clip.setText("string");
    3. Change the DOM (hide the flash movie or an ancestor element)
    4. Set the text again by doing clip.setText("some other string")

    To avoid causing errors, the mouseover event listener should instead be used to set the text:

    
    
        
    
        
    Copy To Clipboard

提交回复
热议问题