【发布时间】:2014-07-03 17:54:29
【问题描述】:
我需要一种方法来从我的按钮中删除 zclip,因为它是动态加载的,并且每次加载它似乎都会添加另一个 zlip 实例,因此会复制多次。
我按照使用指南尝试了 zclip('remove') 但没有运气:
function zclipMe(){
$('#copySearch').zclip({
path: 'http://www.steamdev.com/zclip/js/ZeroClipboard.swf',
copy: function () {
return $(this).prev('.cvl0').text();
},
afterCopy: function(){
var theText = $(this).prev('.cvl0');
var thePosition = $(this).prev('.cvl0').position();
$('.copied').text('Copied!').fadeIn(150).delay(1200).fadeOut(200).css({'top': thePosition.top , 'left': thePosition.left , 'width': theText.width()+30 , 'height': theText.height()+30 , 'line-height': theText.height()+ 30 +'px'});
$(this).zclip('remove');
}
});
}
如您所见,我在要复制的文本上覆盖了一个框,并带有“已复制!”一词显示它已被成功复制,并且这会根据我的动态按钮已加载的次数而触发多次。
谢谢
【问题讨论】: