如何使用 JavaScript 访问 CSS“转换”属性?我试过了,但它不允许我:
function hoverFun(x)
{
x.style.opacity="1";
x.style.transform="rotate(180deg)";
x.style.cursor="pointer";
}
它不识别“旋转(180 度)”。我应该怎么办?我应该怎么打字?请帮忙!
最佳答案
为此你只需要 CSS3:
.box
{
width: 100px;
height: 100px;
background: blue;
opacity: 0.7;
}
.box:hover
{
transition: 1s;
-webkit-transition: 1s;
-moz-transition: 1s;
transform: rotate(360deg);
-webkit-transform: rotate(360deg);
-moz-transform: rotate(360deg);
cursor: pointer;
opacity: 1;
}
关于javascript - 如何用JavaScript访问CSS3的 "transform"属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19284643/