Permalink
Browse files

fixes

  • Loading branch information...
luzc committed Feb 19, 2013
1 parent 1166d1e commit 7b6fe50d288b688ec665f359d74309257c559be9
Showing with 9 additions and 6 deletions.
  1. +9 −6 orientation/index.html
View
@@ -5,17 +5,20 @@
<div id='beta'></div>
<div id='gamma'></div>
<script>
- if(window.ondeviceorientation){
- var do = document.querySelector('deviceorientation');
- do.innerHTML('yes');
- var alpha = document.querySelector('alpha');
- var beta = document.querySelector('beta');
- var gamma = document.querySelector('gamma');
+ var deviceO = document.querySelector('#deviceorientation');
+
+ if('ondeviceorientation' in window){
+ deviceO.innerHTML = 'yes';
+ var alpha = document.querySelector('#alpha');
+ var beta = document.querySelector('#beta');
+ var gamma = document.querySelector('#gamma');
window.addEventListener('deviceorientation', function(e){
alpha.innerHTML = 'alpha = ' + e.alpha;
beta.innerHTML = 'beta = ' + e.beta;
gamma.innerHTML ='gamma = ' + e.gamma;
});
+ } else {
+ deviceO.innerHTML = 'no';
}
</script>
</body>

0 comments on commit 7b6fe50

Please sign in to comment.