欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

基于html2canvas的长图分享

程序员文章站 2022-07-12 20:18:51
...
<span class="ui label yellow compacted basic" onclick="$('#set_campaign_modal').modal({allowMultiple: true}).modal('show');" style="cursor: pointer;">长图分享</span>

<div class="ui modal" id="set_campaign_modal"><i class="close icon"></i><img src="" alt="" class="down_img" style=" display: block;width: 100%; height: 100%;margin: 0 auto;"/></div>


<script type="text/javascript" src="http://html2canvas.hertzen.com/dist/html2canvas.js"></script>

<script type="text/javascript">
	html2canvas($('.show_box')[0], {allowTaint : true,scale:1,taintTest:true,logging:false,useCORS:true}).then(function(canvas) {
	 $('.down_img').attr('src',canvas.toDataURL("image/png"));
	});
</script>