我正在练习使用html2canvas图像纵横比不正确
HTML正文:
的Javascript块:
$(document).ready(function(e) {
$("#button").on("click", function(event) {
html2canvas(document.body, {
allowTaint: true,
taintTest: false,
onrendered: function(canvas) {
var can = document.getElementById('thecanvas');
var destCtx = can.getContext('2d');
destCtx.drawImage(canvas, 0, 0);
}
});
});
});
CSS:
body { height:100%; width:100%; margin:0 !important;
padding:0 !important; overflow:hidden; }
#wrapper { width:100%; height:100%; position: absolute;}
#left { background-color: #dfdfdd; float:left; width:50%; height:100%; }
#right { background-color: #cdcdcd; float:left; width:50%; height:100%; }
#button { padding:20px; width:auto; height:auto; background:#00b1dc; }
#thecanvas { width:80%; height:80%; border:1px solid #fff; margin:10%; }
.littlebox { background:#fff; position:absolute; width:32px; height:32px; }
截图:
2014-03-18
dabouncy