ant-motion icon indicating copy to clipboard operation
ant-motion copied to clipboard

BannerAnimh获取wrapperHeight有问题

Open YoFoon opened this issue 7 years ago • 5 comments

image image 请看图,如果图片太大,太多,_this.dom.getElementsByClassName('banner-anim-elem')会获取不到dom节点,导致wrapperHeight为0,然后就导致了动画为黑屏 第一张图中的第一个红框为组件component自己渲染 第二个红框使用以下图中的方式渲染 image 在这里重新绘制了一次,就不会出现这个问题 希望改进一下

YoFoon avatar Aug 26 '18 09:08 YoFoon

Translation of this issue:


BannerAnimh getting wrapperHeight problem

image image Look at the picture, if the picture is too large, too much, _this.dom.getElementsByClassName('banner-anim-elem') will not get the dom node, causing wrapperHeight to be 0, then causing the animation to be black The first red box in the first picture renders the component component itself. The second red box is rendered using the image below image Repainted here once, this problem will not occur I hope to improve it.

ant-design-bot avatar Aug 26 '18 09:08 ant-design-bot

你确定是图片过大的原因吗???能否提供下示例: https://codesandbox.io/s/42vvz4j4yx ?

jljsj33 avatar Aug 26 '18 18:08 jljsj33

或者你可以考虑在bg上加个高度。。

jljsj33 avatar Aug 26 '18 18:08 jljsj33

不好意思,代码就不贴了。再次仔细看了一下,不跟图片有关吧 bg上的高度也是加了的

在render上输出了一下 image image 看图中,第一次render之后,就获取了wrapperHeight, 但是图片是异步加载的,Element初始的时候没有挂载进去,导致了_this.dom.getElementsByClassName('banner-anim-elem') 这个获取不到,所以不能得到wrapperHeight

顺便说一句,‘across’ 和 ‘vertical’不存在动画黑屏,其他效果存在黑屏

YoFoon avatar Aug 27 '18 01:08 YoFoon

好吧,,我这边有时间再看一下,,,谢谢。。。

jljsj33 avatar Aug 27 '18 02:08 jljsj33