Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图将 div 的旋转范围限制在 90 度到 -90 度之间。div 不应超出我们定义的范围。考虑这个小提琴http://jsfiddle.net/aniprasanth/Cc6cr/1/。提前致谢
在您的 jsfiddle 中,您现在已经知道度数是多少,因此您可以在更改 CSS transorm 属性之前检查旋转是否在您定义的范围内:
if(degree < 90 && degree > -90) { // css transform changes }
这只会应用在 -90 度和 90 度之间的旋转。