Hi, I'm trying to use Zeroclipboard
http://code.google.com/p/zeroclipboard/
to copy stuff to the clipboard and add a tooltip when the mouse hover on the flash. but it doesn't seem to be working.
my html code:
<div id="code1'" class="cptext" rel="'.$url.'">copy text</div>
<div id="cd1" class="test" style="display: none; border: 1px solid #ccc; padding: 8px;">testtest</div>';
<div id="code2'" class="cptext" rel="'.$url.'">copy text</div>
<div id="cd2" class="test" style="display: none; border: 1px solid #ccc; padding: 8px;">testtest</div>';
<div id="code3'" class="cptext" rel="'.$url.'">copy text</div>
<div id="cd3" class="test" style="display: none; border: 1px solid #ccc; padding: 8px;">testtest</div>';
my js code: i have added the jquery library
ZeroClipboard.setMoviePath("http://example.com/js/ZeroClipboard.swf");
var clip = null;
var url = '';
function init() {
clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
$('.cptext').mouseover( function() {
clip.setText(this.innerHTML);
$('.test').css("display","block");
if (clip.div) {
clip.receiveEvent('mouseout', null);
clip.reposition(this);
} else {
clip.glue(this);
}
clip.receiveEvent('mouseover', null);
url = $(this).attr('rel');
});
clip.addEventListener('mouseUp', function(client) {
window.open(url);
});
clip.addEventListener('mouseOut', function (client) {
$('.test').css("display","none");
});
}
$(document).ready(function() {
init();
});