We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
现象: 直接打开指向某楼层的链接,途中因为浏览器正在下载前面楼层的帖子的图片,帖子发生高度变化,从而使得页面发生抖动,导致滚动位置不精确
解决思路: 数据库增加帖子高度的额外字段,提交帖子时检测图片的高度并保存,再在渲染时指定容器的 min-height
The text was updated successfully, but these errors were encountered:
一个比较骚的思路: 监听帖子的 img onload 事件,然后再重新触发楼层跳转
Sorry, something went wrong.
feat: optimize the layout shift when image load first time #31
31668d9
改好了,这里没有采用上述的办法: 而是借助 image 的 width / height 属性,指定完整的 width / height 来固定住 img 的 aspect ratio,避免 loading 过程中发生偏移。
思路:
细节:
fetchImageSizeAllowList
max-width: 100%
height: auto
fix: optimize the layout shift when image load first time #31
b0efd46
No branches or pull requests
现象:
直接打开指向某楼层的链接,途中因为浏览器正在下载前面楼层的帖子的图片,帖子发生高度变化,从而使得页面发生抖动,导致滚动位置不精确
解决思路:
数据库增加帖子高度的额外字段,提交帖子时检测图片的高度并保存,再在渲染时指定容器的 min-height
The text was updated successfully, but these errors were encountered: