From c012a0e5eb973210e21d7af251f2229245f10a7f Mon Sep 17 00:00:00 2001 From: Darren Date: Sun, 30 Nov 2014 02:42:03 +0000 Subject: [PATCH] .touch css class when a touch event is seen --- client/src/views/application.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/views/application.js b/client/src/views/application.js index 3d01d34..13dd1b8 100644 --- a/client/src/views/application.js +++ b/client/src/views/application.js @@ -44,13 +44,19 @@ _kiwi.view.Application = Backbone.View.extend({ // Keep tabs on the browser having focus this.has_focus = true; - $(window).on('focus', function () { + $(window).on('focus', function windowOnFocus() { that.has_focus = true; }); - $(window).on('blur', function () { + $(window).on('blur', function windowOnBlur() { that.has_focus = false; }); + // If we get a touchstart event, make note of it so we know we're using a touchscreen + $(window).on('touchstart', function windowOnTouchstart() { + that.$el.addClass('touch'); + $(window).off('touchstart', windowOnTouchstart); + }); + this.favicon = new _kiwi.view.Favicon(); this.initSound(); -- 2.25.1