Incomplete screenshots using html2canvas, scroll bar dragging issues

Incomplete screenshots using html2canvas, scroll bar dragging issues

Before processing, if the page is very long, you need to set the scroll bar to the top, and then call the method

window.pageYoffset = 0;
document.documentElement.scrollTop = 0;
document.body.scrollTop = 0;、、

part of the code

		window.pageYoffset = 0;
        document.documentElement.scrollTop = 0;
        document.body.scrollTop = 0;
		html2Canvas(document.querySelector('#id'), {
    
    
		  allowTaint: false,
		  logging: false,
		  useCORS: true
		}).then(function (canvas) {
    
    
			//进行操作
		})

Guess you like

Origin blog.csdn.net/weixin_41891519/article/details/114587592