[go: nahoru, domu]

Skip to content

Danzeer/jquery-zeroclipboard

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jquery-zeroclipboard

See ZeroClipboard for details about the underlying mechanism.

This is a jQuery plugin that makes the ZeroClipboard library more conveniently available.

Simple Example

$(function {
    $.zeroclipboard({
            moviePath: '/path/to/ZeroClipboard.swf',
            activeClass: 'active',
            hoverClass: 'hover'
        });

    // To glue a button
    $('#my-button').zeroclipboard({
        dataRequested: function (event, setText) {
            // In order to dynamically set the text to copy to the clipboard
            // at the time the mouse clicks the button
            // NOTE: this function is called within the execution context of the flash movie,
            // therefore any exception might be silently ignored.
            // NOTE 2: the function "setText" should be called during the execution of this
            // callback otherwise the text copied on the clipboard will not be correct.
            // Therefore any AJAX call should be configured to be SYNCHRONOUS
            setText($('#my-text-area').val());
        },
        complete: function () {
            // Do something after the text has been copied to the system clipboard
            // (like notifying the user)
        }
    });
});

Credits and similar work

zClip is a similar plugin but it embeds an older version of ZeroClipboard and seems to be not maintained anymore.

About

jQuery ZeroClipboard Plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published