SuperClipBoard
Copying text to the clipboard with javascript,
high performance,no Flash, no dependece.
- Just 2KB
- Easy to get started, only two interface(bind and copy)
- High performance, copy speed: 3000KB/s
Getting started
Step 1:Install
npm install fast-clipboard --save
You can also download the file directly.
Step 2:Import js file
<script type="text/javascript" src="../dist/superClipBoard.min.js"></script>
Step 3: Bind
<button id="btn" data-copy-content="Hello">copy 'Hello'</button><script> // fast bind superClipBoard;</script>
Usage
Bind copy event
Set a 'data-copy-content' attribute in your trigger element
<div class="example1" data-copy-content="Hello World">copy</div>
then you can using a variety of selector to bind copy event.
// example1: document selectorsuperClipBoard; // example2: selector like jquerysuperClipBoard; // example3: jquery nodes (import jquery)superClipBoard; // example4: simple dom arraysuperClipBoard;
DIY copy event
// You can use any event such as click, mouseover, mouseover etc.. to bind copy behavior// IE browser using 'attachEvent' binding eventdocument;
Copy feedback
Both 'copy' and 'bind' are provide feedback.
// copy feedbackvar option = { ; } { ; }// bind Eventdocument;// fast bindsuperClipBoard;