ZEROCLIPBOARD 複製粘貼

1.添加dom

<span id="fu_container"><a href="javascript:;" id="fu_btn">點擊複製推廣地址</a></span>
<input type="hidden" value="<?php echo $activity->act_url;?>" id="fu_text" />

2.js

if($("#fu_text").length>0){
		
	var clip = null;
	clip = new ZeroClipboard.Client();
	clip.setHandCursor(true);  	
	clip.addEventListener('mouseOver', function (client) {
		clip.setText($("#fu_text").val());
	});
		
	clip.addEventListener('complete', function (client, text) {
		$("#fu_success").fadeIn(1000,function(){
			$(this).fadeOut(6000);
		});
	});
		
	clip.glue('fu_btn','fu_container');
}

教程:https://github.com/zeroclipboard/ZeroClipboard
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章