我自己找到了解决办法。
这是我的SCS(请注意添加的“show”)
.some_class{
width: 30%;
height: 120px;
margin-left: 10%;
margin-right: 10%;
margin-top: 100px;
float: left;
@include boxShadowLevel(2);
transition: box-shadow 0.4s, transform 0.4s;
transform: scale(0);
&.show{
transform: scale(1);
}
&:nth-child(odd):hover{
transform: translate(-3px, -3px) scale(1.1);
@include boxShadowLevel(3);
}
&:nth-child(even):hover{
transform: translate(3px, -3px) scale(1.1);
@include boxShadowLevel(3);
}
// Some more css here (which is not relevant for the question)
}
然后添加类“show”,而不是在js代码中手动设置转换:
$(elem[i]).addClass("show")