From c7f78fee3e5c9a78dbd6c22910ca529a0ee34827 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 14 Sep 2015 17:56:47 -0400 Subject: device orientation --- StoneIsland/www/js/lib/nav/IntroView.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'StoneIsland/www/js/lib/nav/IntroView.js') diff --git a/StoneIsland/www/js/lib/nav/IntroView.js b/StoneIsland/www/js/lib/nav/IntroView.js index 21e3c2b2..6e04a39e 100644 --- a/StoneIsland/www/js/lib/nav/IntroView.js +++ b/StoneIsland/www/js/lib/nav/IntroView.js @@ -6,6 +6,19 @@ var IntroView = View.extend({ }, initialize: function(){ + this.logo = this.$("#logo").get(0) + window.addEventListener("deviceorientation", deviceorientation) + }, + + deviceorientation: function(e){ + var heading + if ('webkitCompassHeading' in e) { + heading = e.webkitCompassHeading + } + else { + heading = e.alpha + } + this.logo.css[transformProp] = "translateZ(0) rotate(" + heading + "deg)" }, -}) \ No newline at end of file +}) -- cgit v1.2.3-70-g09d2