t = $(window).height(); let screenWidth = $(window).width(); let screenHeight = $(window).height(); $(window).resize(function () { screenWidth = $(window).width(); screenHeight = $(window).height(); s.close(); }); if (screenWidth >= 1200) { newHeight = 394; newWidth = 150; } else if (screenWidth >= 1024) { newHeight = 376; newWidth = 130; } else { newHeight = 349; newWidth = 120; } s = dialog({ fixed: false, width: newWidth, height: newHeight, top: "41px", quickClose: true, onclose: function () { setTimeout(function () { hidden = true; }, 500); }, }); s.show(myCategory); s.content(myCategoryHtml); });