【问题标题】:zeroclipboard is not working version2.1.1zeroclipboard 不工作 version2.1.1
【发布时间】:2014-08-16 11:49:47
【问题描述】:

我正在尝试使用 zeroclipboard 2.1.1

我添加了 zeroclipboard.js 和 zeroclipboard.sw,但是当我单击按钮时,没有任何内容成为副本。 虽然当我右键单击按钮时,会出现 Flash 播放器设置。

有什么帮助吗?

$(document).ready(function(){

var client = new ZeroClipboard(document.getElementById("Button2"));

client.on("ready", function (readyEvent) {
     alert( "ZeroClipboard SWF is ready!" );

    client.on("aftercopy", function (event) {
        // `this` === `client`
        // `event.target` === the element that was clicked
        //event.target.disabled = true;
        //alert("Copied text to clipboard: " + event.data["text/plain"]);
    });

    client.on('error', function (event) {
         console.log( 'ZeroClipboard error of type "' + event.name + '": ' + event.message );
        ZeroClipboard.destroy();
    });
});
});

此警报alert( "ZeroClipboard SWF is ready!" ); 未显示

我已经添加了 jquery 2.1

【问题讨论】:

    标签: javascript jquery zeroclipboard


    【解决方案1】:

    我刚刚想通了.. 需要单击 Flash 元素才能进行复制。对我来说,该元素被添加到与我的实际按钮偏移约 10 像素的位置,因此永远不会被点击。使用 css 将其绝对定位在按钮上,它应该适合您! (为此感到沮丧数小时?糟糕的文档!)

    您还需要这样做以添加电影并确保包含您的 Zeroclipboard.js

                  ZeroClipboard.config({ 
                  swfPath: moviepath,
                  forceHandCursor: true});
    

    【讨论】:

      猜你喜欢
      • 2015-06-18
      • 1970-01-01
      • 2015-12-02
      • 1970-01-01
      • 2012-10-16
      • 1970-01-01
      • 2015-08-15
      • 1970-01-01
      • 2013-09-09
      相关资源
      最近更新 更多