Use the DeviceOrientation feature of Html5 to implement the shake function. New html5 features
Many mobile websites now have the same shake function, such as what to shake to receive a red envelope, receive a gift, etc.
1. deviceOrientation: encapsulates the event of the direction sensor data to obtain the direction data of the mobile phone in the static state, such as the angle, orientation, and orientation of the mobile phone.
2. deviceMotion: encapsulates motion sensor data events to obtain motion acceleration data during mobile phone motion.
It is useless to say more, and the code is healthy:
<! DOCTYPE html>
You can directly paste it, but you must prepare the music link yourself.
I can shake it with html5, but it can be opened with UC browser, but it cannot be used if it is encapsulated into webview. How can this problem be solved?
Is Gravity sensing not called after being encapsulated into webview, or it is completely ineffective... I don't know. I can see that I can call sensors like gravity sensing with phonegap on the internet ..