【发布时间】:2019-08-11 04:55:23
【问题描述】:
我希望图像的行为就像它被设置为背景 URL 一样,并且功能如下:
img.thisIsMyImage {
background: url("../../services/images/hehe.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
animation: increase 60s linear 10ms infinite;
-webkit-transition: all 5.2s ease-in-out;
-moz-transition: all 5.2s ease-in-out;
-ms-transition: all 5.2s ease-in-out;
-o-transition: all 5.2s ease-in-out;
transition: all 5.2s ease-in-out;
}
这是反应代码
render() {
return (
<div>
<img src={rsm_logo} className="thisIsMyImage" alt="containerLogo" />
<LoginForm submit={this.submit} />
</div>
)
}
当像上面 CSS 中的代码一样完成时,这工作得非常好,但我希望它应用于元素“thisIsMyImage”上的 .jsx 代码中的元素,并且仍然有与 css 代码中的行为相同。
非常感谢任何建议,谢谢。
【问题讨论】: