Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不在可视区域内的元素如何截图 #116

Open
cj1215 opened this issue Nov 11, 2024 · 1 comment
Open

不在可视区域内的元素如何截图 #116

cj1215 opened this issue Nov 11, 2024 · 1 comment

Comments

@cj1215
Copy link

cj1215 commented Nov 11, 2024

常见的需求:生成海报,但是生成海报的元素不需要在页面上显示,会设置样式 position:fixed:top: 0;left:-1000px; 此时如何生成截图呢

@bymomo
Copy link

bymomo commented Dec 13, 2024

截图前先让父级元素高度=可滚动元素的高度,设置overflow-y: unset;然后再截图就行了,截图完后恢复原来的css设置overflow-y: auto;
参考:bubkoo/html-to-image#388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants