條件
1.wex5(3.6)
2.一部手機(或者手機模擬器也可以,我用的是天天模擬器)
3.一臺服務器(阿里雲/網易蜂巢... ... 都行)
服務器上的html
<!DOCTYPE html>
<html>
<head>
<title>vibrant</title>
<script type="text/javascript" charset="utf-8" src="/cordova.js"></script>
<script type="text/javascript" charset="utf-8">
function vibrant(e) {
navigator.vibrate(e); // 震動e毫秒 e/1000秒
}
function cencal_vibrant() { // 取消震動
navigator.cancelVibration();
}
</script>
</head>
<body>
<button οnclick="vibrant(3000);">震動3秒</button> <br>
<button οnclick="vibrant(100000);">震動100秒</button> <br>
<button οnclick="cencal_vibrant();">取消震動</button> <br>
</body>
</html>
開始(看圖就好)