From 8c97a33735a4d9fbfede9d8b52762b39f58ac7df Mon Sep 17 00:00:00 2001 From: Anders Gustafsson <34234789+anders-photowall@users.noreply.github.com> Date: Mon, 30 Nov 2020 14:52:18 +0100 Subject: [PATCH] P5-2413 - Remove $(window).width() calls --- dist/image-editor.js | 3 +-- examples/basic/app.js | 6 +++--- src/utils/is-mobile.js | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dist/image-editor.js b/dist/image-editor.js index 45bdc70..c5d0225 100644 --- a/dist/image-editor.js +++ b/dist/image-editor.js @@ -2373,10 +2373,9 @@ module.exports = isFullscreen; },{}],31:[function(require,module,exports){ 'use strict'; -/* globals $ */ function isMobile() { - return $(window).width() < 768; + return window.innerWidth < 768; } module.exports = isMobile; diff --git a/examples/basic/app.js b/examples/basic/app.js index 13b114b..fc87366 100644 --- a/examples/basic/app.js +++ b/examples/basic/app.js @@ -98,9 +98,9 @@ function getWrapperData() { var $navbar = $('.image-editor__navbar'); var isFullScreen = isFullscreen(); - var isMobile = $window.width() <= 767; - var windowHeight = window.innerHeight ? window.innerHeight : $window.height(); - var windowWidth = window.innerWidth ? window.innerWidth : $window.width(); + var isMobile = window.innerWidth <= 767; + var windowHeight = window.innerHeight; + var windowWidth = window.innerWidth; return { width: isFullScreen ? windowWidth : (isMobile ? windowWidth : $wrapper.width()), diff --git a/src/utils/is-mobile.js b/src/utils/is-mobile.js index 6804797..6a806de 100644 --- a/src/utils/is-mobile.js +++ b/src/utils/is-mobile.js @@ -1,8 +1,7 @@ 'use strict'; -/* globals $ */ function isMobile() { - return $(window).width() < 768; + return window.innerWidth < 768; } module.exports = isMobile;