javascript - Click the button to let js control the rotation of the div. It can only be rotated once, and it will no longer rotate when clicked again?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-19 10:30:33
0
3
811

The first time the button is clicked, p will rotate 90 degrees. Clicking it again will be useless.

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(3)
左手右手慢动作

Get the current degree of rotation and add 90 to it instead of setting the world to 90

世界只因有你

1. That’s because your perspective has never changed

Ty80

This question is easy to say, just like the answers of the two people above, neither simple nor simple.
If you write more standardizedly.

//获取元素
var op = document.getElementById("box");

//每次点击获取其旋转的角度
//这里由于需要获取transform:ratate属性是比较麻烦的。
//我们记为操作Action,得到结果为nCurrRotate。

//设置新的值
box.style.transform='rotate('+ (nCurrRotate+90) +'deg)';

Action

Action reference here: [1]: http://blog.5ibc.net/p/25577....

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!