我有以下代码
define(['jquery'], function ($) {
"use strict";
var screenSize;
screenSize = {
isSmallScreen: function () {
var smallScreen = $(".container-inner").width() <= 570;
$(window).resize(function () {
smallScreen = $(".container-inner").width() <= 570;
});
return smallScreen;
}
}
return screenSize;
});
我可以调用 screenSize.isSmallScreen(); 在其他文件中并获取 smallScreen 的返回值,但在我调整窗口大小时没有。我怎么做?