首页 > 代码库 > ZeroClipboard 复制到剪切板 的一些事件

ZeroClipboard 复制到剪切板 的一些事件

ZeroClipboard.config({
    moviePath: "http://zeroclipboard.org/javascripts/zc/ZeroClipboard_1.3.1.swf",
    cacheBust: false,
    forceHandCursor: true,
    autoActivate: false,
    debug: true
});

var client = new ZeroClipboard();

client.on("load", function (client) {
    console.log("load");

    client.on("complete", function (client, args) {
        console.log("complete");
    });

    client.on("dataRequested", function (client, args) {
        console.log("dataRequested");
        client.setText("TestX");
    });

    client.on("mouseover", function (client) {
        console.log("mouse over");
    });

    client.on("mouseout", function (client) {
        ZeroClipboard.deactivate();
        console.log("mouse out");
    });

    client.on("mousedown", function (client) {
        console.log("mouse down");
    });

    client.on("mouseup", function (client) {
        console.log("mouse up");
    });
});

$(document).on("mouseover", ".testButton", function (e) {
    var text = $(this).attr("data-text");

    client.setText(text);
    ZeroClipboard.activate(this);
});

$("#testButton").click(function (e) {
    $("body").append($("#template").clone());
});

ZeroClipboard 复制到剪切板 的一些事件