A solution of the capture with scroll issue by @songxingguo
height: fit-content
A code snippet that works for me:
const capture = () => {
const node = document.getElementById('timeline-list');
const currentHeight = node.style.height;
node.style.height = 'fit-content';
html2canvas(node)
.then(function (canvas) {
const imgData = canvas.toDataURL('image/png');
const link = document.createElement('a');
link.href = imgData;
link.download = 'captured-image.png';
link.click();
})
.finally(() => {
node.style.height = currentHeight;
});
};
Can I use "fit-content"? supported browser list