标签:z-index one cti top ati 摇一摇 fft javascrip asc
// 摇一摇 var SHAKE_THRESHOLD = 1600; 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(‘本设备不支持摇一摇事件‘); } 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) { openswt(); } last_x = x; last_y = y; last_z = z; } } // function doResult() { // window.location.href = "tel:";} function openswt() {window.location.href = "/call.html";} document.write(‘<div style="position:fixed;top:2%;right:0px;width:55px;z-index:10000;"><a href="javascript:getSwt(\‘yao\‘);"><img src="http://www.baidu.com/images/yao.gif" width="55" border="0"></a></div>‘);
标签:z-index one cti top ati 摇一摇 fft javascrip asc
原文地址:http://www.cnblogs.com/zuosong160522/p/6821351.html