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

fix: calculate width and height with decimal #22778

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

EvanMaFYH
Copy link

carousel组件在计算宽高度的时候使用的是offsetWidth和offsetHeight,计算出来的只会是整数,但在有些情况下实际的宽度和高度会存在小数,例如在使用rem等为单位的情况下,误差零点几px的情况在chrome浏览器下(其他浏览器未进行测试)会导致当前页面展示了部分下一个非激活carousel-item的部分内容,比如carousel-item内元素的的最左侧存在border,会在当前active的carosuel-item的最右侧出现下一个非激活carousel-item的border,情况出现在使用offsetWidth计算出的宽度小于实际宽度的时候,也就是说比如当实际宽度是800.44而offsetWidth得到的值是800的时候会出现问题,而实际宽度是800.97offsetWidth得到的值是801的时候不会出现上述问题

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

Successfully merging this pull request may close these issues.

None yet

1 participant