怎么写禁止摇一摇函数? function shakeStop(); var SHAKE_THRESHOLD = 1000; var last_update = 0; var x = y = z = last_x = last_y = last_z = 0; if (window.DeviceMotionEvent) { window.addEventListener('devicemotion', deviceMotionHandler, false); } else { alert('本设备不支持devicemotion事件'); } function deviceMotionHandler(eventData) { var acceleration = eventData.accelerationIncludingGravity; var curTime = new Date().getTime(); if ((curTime - last_update) > 100) { var diffTime = curTime - last_update; last_update = curTime; x = acceleration.x; y = acceleration.y; z = acceleration.z; var speed = Math.abs(x + y + z - last_x - last_y - last_z) / diffTime * 10000; var status = document.getElementById("status"); if (speed > SHAKE_THRESHOLD) { doResult(); } last_x = x; last_y = y; last_z = z; } } function doResult() { //这里是弹窗 当弹窗弹出来,就禁止继续摇一摇,怎么写? congratulationTc(); audio2.play(); audio1.pause(); $('.god_animation').removeClass('zindex'); }
添加回答
举报
0/150
提交
取消