gpt4 book ai didi

javascript - 小数滚动高度?

转载 作者:数据小太阳 更新时间:2023-10-29 04:47:55 35 4
gpt4 key购买 nike

https://developer.mozilla.org/en-US/docs/Web/API/element.scrollHeight :

This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect().

除了... element.getBoundingClientRect() 不返回 scrollHeight。如何获得小数的 scrollHeight?可能吗?

最佳答案

我想我可能有解决方案:

var rect = element.getBoundingClientRect()
var scrollHeight = element.scrollHeight + (parseInt(rect.height) - rect.height)
var scrollWidth = element.scrollWidth + (parseInt(rect.width) - rect.width)

关于javascript - 小数滚动高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21666892/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com