P5-2413 - Remove $(window).width() calls

This commit is contained in:
Anders Gustafsson
2020-11-30 14:52:18 +01:00
committed by GitHub
parent f9fbc8d34f
commit 8c97a33735
3 changed files with 5 additions and 7 deletions
+1 -2
View File
@@ -2373,10 +2373,9 @@ module.exports = isFullscreen;
},{}],31:[function(require,module,exports){ },{}],31:[function(require,module,exports){
'use strict'; 'use strict';
/* globals $ */
function isMobile() { function isMobile() {
return $(window).width() < 768; return window.innerWidth < 768;
} }
module.exports = isMobile; module.exports = isMobile;
+3 -3
View File
@@ -98,9 +98,9 @@
function getWrapperData() { function getWrapperData() {
var $navbar = $('.image-editor__navbar'); var $navbar = $('.image-editor__navbar');
var isFullScreen = isFullscreen(); var isFullScreen = isFullscreen();
var isMobile = $window.width() <= 767; var isMobile = window.innerWidth <= 767;
var windowHeight = window.innerHeight ? window.innerHeight : $window.height(); var windowHeight = window.innerHeight;
var windowWidth = window.innerWidth ? window.innerWidth : $window.width(); var windowWidth = window.innerWidth;
return { return {
width: isFullScreen ? windowWidth : (isMobile ? windowWidth : $wrapper.width()), width: isFullScreen ? windowWidth : (isMobile ? windowWidth : $wrapper.width()),
+1 -2
View File
@@ -1,8 +1,7 @@
'use strict'; 'use strict';
/* globals $ */
function isMobile() { function isMobile() {
return $(window).width() < 768; return window.innerWidth < 768;
} }
module.exports = isMobile; module.exports = isMobile;