在Cute File Browser中复制到剪贴板

时间:2015-08-04 07:15:36

标签: javascript php jquery browser copy-paste

我对Cute File Browser和此script

有疑问

在Stackoverflow页面上,副本到剪贴板可以正常工作但是当我将脚本添加到可爱文件浏览器中以复制链接时,单击它不起作用,浏览器也会忽略

e.preventDefault() 

代码。你能帮帮我说什么错了吗?

所以这是来自script.js并添加了代码:

// Clicking on breadcrumbs
    breadcrumbs.on('click', 'a', function(e){
        e.preventDefault();

        var index = breadcrumbs.find('a').index($(this)),
            nextDir = breadcrumbsUrls[index];                            
                    breadcrumbsUrls.length = Number(index);

                    //before it was window.location.hash instead of var cope
        var cope = encodeURIComponent(nextDir);
        var aux = document.createElement("input");
        aux.setAttribute("type", "text");
        aux.setAttribute("id", "temp");
        aux.setAttribute("style", "position:absolute;opacity:0;");
        aux.setAttribute("value", cope);
        document.body.appendChild(aux);
        aux.select();
        document.execCommand("copy");
        document.body.removeChild(aux);
    });
我做错了什么?

1 个答案:

答案 0 :(得分:-2)

我也很难将其付诸实践。我弄乱了整件事并摆弄它。欢迎你来叉。 Fiddle

breadcrumbsUrls
相关问题