无法让ZClip工作 [英] Can't get ZClip to work

查看:79
本文介绍了无法让ZClip工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道它甚至可以在这个网站上工作,但只有当我通过h1元素触发它时,我需要通过图像(代表副本)触发它,但是当我尝试它时根本不起作用。这是我的Javascript:

I know it works even on this site but only when I trigger it via the h1 element, and I need to trigger it via an image (representing copy) but when I try it simply won't work. Here's my Javascript:

$('#copyTxt').click(function(){
       alert($('#Txt2Copy').text());
       $(this).zclip({
           path: '/scripts/js/ZeroClipboard.swf',
           copy: $('#Txt2Copy').text(),
           afterCopy: function(){
               alert($('#Txt2Copy').text() + " was copied to clipboard");
           }
       });
    });

警报只是为了让我确保它到达而它确实不会复制,如果我添加 beforeCopy 我会在那里收到一条消息,但它不再移动。

The alert was just for me to make sure it reaches and it does it just won't copy, if I add the beforeCopy I do get a message there but it moves no further.

id copyTxt 已被移动到span,img,tr,td和表本身,但除非我从H1中激活事件,否则它将无法工作。图片所在的HTML:

The id copyTxt has been moved to a span, an img, tr, td, and the table itself but it just WON'T work unless I fire the event from the H1. The HTML in which the image is:

<tr>
          <td><label for="navUrl">Navigation URL &nbsp;<img id="copyTxt" src="/images/copy.png"/></label></td>
          <td id="Txt2Copy"><?= $this->order["order"]["navigationUrl"] ?></td>
        </tr>


推荐答案

这是绝对定位问题。这个问题已在这里得到解答:

zclip无法在表格内工作

This is an absolute positioning problem. This question has been answered here:
zclip not working inside table

我遇到了同样的问题现在已经解决了!

I had the same problem it is fixed now!

所以在你的情况下添加一个包装器到你的链接,像这样:

So in your case add a wrapper to your link, like this:

<div style="position:relative">
<img id="copyTxt" src="/images/copy.png"/>
</div>

这篇关于无法让ZClip工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆