scrollForever icon indicating copy to clipboard operation
scrollForever copied to clipboard

解决浏览器窗口缩小到一定比例,scrollLeft(scrollDistance + 1)不生效问题

Open flym1013 opened this issue 2 years ago • 0 comments

浏览器缩放的时候,scrollLeft+ 1会被设置成 1 * window.devicePixelRatio, 如果结果小于1就会被判定成+ 0, 所以需要保证每次变化的值大于1 const ratio = parseFloat((1 / window.devicePixelRatio).toFixed(2) ) + 0.01 // + 0.01 为了保证 ratio >= 1 dom1.scrollLeft= dom1.scrollLeft+ ratio

flym1013 avatar Oct 30 '23 08:10 flym1013