标签:
$(function(){ window.addEventListener("deviceorientation", handleOrientation); function handleOrientation(event) { var absolute = event.absolute; var alpha = event.alpha; var beta = event.beta; var gamma = event.gamma; $(‘.box‘).html(gamma) if(gamma<-20 || gamma>20){ return false; } $(‘.bg‘).css({‘margin-left‘:-gamma*10,‘-webkit-transform‘:‘rotateY(‘+gamma+‘deg)‘}); } })
标签:
原文地址:http://www.cnblogs.com/smjia/p/5585166.html