【发布时间】:2020-01-16 02:18:24
【问题描述】:
我的html2canvas 上有一个空白区域,我不确定发生了什么。这是我目前的代码。
function doFunction() {
html2canvas(document.querySelector("#capture"), ).then(canvas => {
$("body").append(canvas);
});
}
$("button").click(function() {
doFunction();
});
div {
box-sizing: border-box;
font-family: 'ABeeZee', sans-serif;
}
body {
background-color: red;
}
#capture {
width: 900px;
height: 900px;
background-color: aqua;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<div id="capture">
Hello
</div>
<button type="button">Click Me!</button>
这是附加的画布。请注意,顶部有一个空白区域。如何删除它?
【问题讨论】:
-
您好,我也面临同样的问题。有什么解决方案有效吗?
-
@BhumiSukhadiya 尝试了一切,但仍然面对它..
标签: javascript html css html2canvas