开发者

jQuery zClip not working in UI dialog in Chrome and IE9 (works in FireFox)

Following works in chrome, IE9 and Firefox on a .php:

$(document).ready(function(){
$('#copyLinkButton').zclip({
path: "js/zclip/zclip.swf",
copy: function(){
return $('#linkToCopy').html();
},
beforeCopy:function(){
},
afterCopy:function(){
//succes
}
});
});

But opening it in a Dialog, it only works in Firefox and IE9-compatible mode:

$('.open-lv-form').live({
click: function() {
//define link
var linkViewId = this.id;

$.ajax({
type: "GET",
cache: false,
url: "redirect.php",
data: "id="+linkViewId,
success: function(response){
$("#lv-form-content").html(response);
}
}); 

//open
$( "#lv-form" ).dialog( "open" );
return fa开发者_开发技巧lse;
}
});

Is it the way IE and Chrome handles the fields? Why will it work in Firefox and not in chrome and IE?

Thanks in advance!

Update: IE9 (f12) says runtime error on zclip.min.js line 12 from character 3666, line says:

this.div.innerHTML=this.getHTML(c.width,c.height)}

Still no solution, keep trying :)

More info: Jquery ZeroClipboard or Zclip nothing in clipboard IE 8 and 7

Update #2:

Solved in IE to use this instead of zClip:

window.clipboardData.setData('text',item.url); 

Now only Chrome is struggling. Seems there is a security feature in chrome that disables interaction with OS. Keep me informed!


I solved the problem with chrome by changing the z-index value on zclip.js

var zIndex = 99;

to

var zIndex = 1500;


I had this issue as well in IE9. Clicking the flash to copy to clipboard would not function properly in IE. I fixed this by adding a doctype to the page. For me this fixed my issue:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


See the source code of jquery.zclip.js, you will find the following:

// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
if (this.domElement.style.zIndex) {
zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
}

so if set the zindex of the zclip div, you must set calling domelment's zindex, like this:

<a href="##" style="z-index:10000">copy to clipboard</a>

Hope to help you!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜