html2canvas,可在本地使用,但不能在生产中使用

时间:2018-09-20 13:57:29

标签: javascript jquery html2canvas

我正在使用html2canvas进行项目。 我为某种产品动态生成一些图像,然后使用html2canvas保存它们。这在我的本地服务器上工作正常,但是当我提交生产中的所有内容时,代码不起作用。 在讲述生产中发生的事情之前,我将向您展示代码。

$('.open-img-builder').click(function() {
var att = $(this);
$('#image_builder').dialog({
  autoOpen: true,
  modal: true,
  width: 1000,
  height: 600,
  title: 'Build Image',
  buttons: {
    'Cancel': function(){
      $(this).dialog('close');
    },
    'Confirm': function(){

     html2canvas(document.getElementById('image-live')).then(function(canvas) { 
            #code here
           });
        });
      });

    }
   }
 });
  #here goes the open and close function but they're not linked with the problem
});

我显示了将保存在对话框中的图像,并且当用户按确认时,应该保存图像,但这不会发生。
唯一发生的是,每次用户按下确认,对话框都会重复一次。
有人遇到相同的问题并找到答案了吗?

UPDATE1:我只是试图在“ then(function()””之后放置一个“警报”,但是什么也没发生,所以我不认为问题出在那

UPDATE2:我试图在另一个随机元素上使用html2canvas进行“截屏”,哦,文档,并且...适用于所有内容,但不适用于我需要的地方...

UPDATE3:我刚刚看到了一些东西。当我单击“确认”按钮时,文档中将显示一个iframe。

<iframe class="html2canvas-container" scrolling="no" data-html2canvas-ignore="true" style="visibility: hidden; position: fixed; left: -100000px; top: 0px; border: 0px none;" width="1408" height="640"></iframe>

0 个答案:

没有答案
相关问题