Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes

  • Loading branch information...
commit 7b6fe50d288b688ec665f359d74309257c559be9 1 parent 1166d1e
@luzc authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 orientation/index.html
View
15 orientation/index.html
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.