zeroclipboard工作的一半时间

时间:2015-09-06 21:38:15

标签: javascript css https zeroclipboard

出于某种原因,这个zeroclipboard实现只有一半的时间刷新页面。它在完全https页面上作为https提供。有一点需要注意的是,我可以告诉我何时刷新页面它不会起作用,因为bit.ly链接似乎最初变为蓝色(默认的a-link颜色),然后立即切换到我的style.css设置。

<script src="./js/jquery-2.1.3.min.js" type="text/javascript"></script>
<script src="./js/ZeroClipboard.js" type="text/javascript"></script>
<script src="./js/zeroclip.js"></script>

这是我的zeroclip.js的内容:

ZeroClipboard.setMoviePath('http://www.ultrasoundoftheweek.com/clipshare/js/ZeroClipboard10.swf');
var clip2 = new ZeroClipboard.Client();
jQuery(document).ready(function() {
    clip2.addEventListener('mousedown', function() {
        var alltext = $('#result').text();
        clip2.setText(alltext);
    });
    clip2.addEventListener('complete', function() {
        $("#copybutton").html("<font color=\"#434343\"><strike>Copy Link to Clipboard</strike></font><font color=\"#D00000\"> Copied</font>");
        //alert('Copied');
    });
    clip2.glue('copyplain');
});

HTML:

<h2 align="center">ULA ClipShare Uploader</h2>
<br>
<div style="overflow: hidden;">
<div class="topbox">
<h4 class="textl"><a href="https://www.ultrasoundoftheweek.com/clipshare/share.php?&f=e1cQsRltii" >http://bit.ly/1JKAAuJ</a></h4>
<h4 class="textr">Email this Link</h4>
<div class="clear"></div>
<div class="topbox">
<div class="textl" id="copyplain"><button id="copybutton">Copy Link to Clipboard</button></div>
<div id="result" class="result" style="display:none;">http://bit.ly/1JKAAuJ</div>

CSS:

body {
    height: 100%;
    width: 100%;
    text-align: center;
}
#centerContainer {
    height: auto;
    min-height: 100%;
    max-width: 900px;
    text-align: left;
    margin: 0px auto;
    padding-left: 5px;
    padding-right: 5px;
}
P {
    FONT-SIZE: 8pt;
    COLOR: #000000;
    FONT-FAMILY: Oxygen
}
TD {
    FONT-SIZE: 8pt;
    COLOR: #000000;
    FONT-FAMILY: Oxygen
}
h2 {
    FONT-FAMILY: Oxygen
}
h4 {
    FONT-FAMILY: Oxygen
}
.topbox {
    display: table;
    width: 100%;
    height: auto;
    margin: 0px 0px;
}
.topbox .textl {
    display: table-cell;
    height: 32px;
    vertical-align: middle;
    display: inline-block;
}
.topbox .textr {
    display: block;
    float: right;
}
.topbox .clear {
    clear: both;
}
#copyplain {
    position: absolute
}
#copywrite {
    clear: both;
    position: relative;
    z-index: 10;
    height: 3em;
    margin-top: -3em;
}

1 个答案:

答案 0 :(得分:0)

如果有其他人遇到这个问题,我可以在一小时的修补后解决它。如果我将<script src="./js/zeroclip.js"></script>行放在</body>上方,则代码可以正常工作。我想由于某种原因,它不喜欢我的jQuery(document).ready(function()