Quantcast
Channel: Notes of a Developer » Chrome
Viewing all articles
Browse latest Browse all 3

Chrome deviceorientation event in javascript

$
0
0


Video:

1
2
3
4
5
6
7
8
<script language="javascript">
function onOrientation(event) {
        var rotate = 'rotate(' + event.gamma + 'deg)';
        var scale = 'scale(' + ((event.beta/180)*2 + 1) + ')';
        document.getElementById('testlogo').style.webkitTransform = rotate + ' ' + scale;
}
window.addEventListener('deviceorientation', onOrientation);
</script>

The post Chrome deviceorientation event in javascript appeared first on Notes of a Developer.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images