SwfClipboard requires jQuery and swfObject :
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script src="jquery-swfClipboard.js"></script>
$("#button").mouseover(function(){
$(this).swfClipboard('Sth here.');
});
- text (string)
the content you want to copy to the clipboard. - swf (string)
the path of the 'swfClipboard.swf'. This argument has a default value as './swfClipboard.swf', but if you move the swf file to another path, 'swf' is must be set. - callback (function(t))
the callback function has a parameter as the content you want to copy if the copying method complete successfully. - debug (string)
- $(this).swfClipboard(object);
- text
- swf
- callback
- debug
- $(this).swfClipboard(string);
- text
- $(this).swfClipboard(string, function);
- text
- callback
- $(this).swfClipboard(string, string);
- text
- swf
- $(this).swfClipboard(string, string, function) / .swfClipboard(string, function, string)
- text
- swf / callback
- callback / swf
$selector.mouseover(function () {
$(this).swfClipboard(...);
})
e.g. :
<!DOCTYPE HTML>
<html>
<head>
<title>jQuery Plugin - swfClipboard</title>
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/swfobject.js"></script>
<script src="js/jquery-swfClipboard.js"></script>
</head>
<body>
<textarea id="text">Copy me !</textarea>
<button id="copy">Copy</button>
<script type="text/javascript">
$(document).ready(function() {
$("#copy").mouseover(function () {
$(this).swfClipboard({
text : $("#text").text(),
swf : './js/swfClipboard.swf',
callback : function(text){
alert('Completed! The content is : ' + text);
}
});
})
});
</script>
</body></html>
Released under the MIT license.