我正在尝试创建一种方法来警告用户他们正在以低于建议的分辨率查看页面/项目。
我找到的代码但无法完成以下工作。
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" href="http://www.mmicrosysm.net/css/dimensions_warning.css" type="text/css" media="screen" />
<script>
var window_min_height = 768;
var window_min_width = 1366;
var check_size = function() {
var current_height = jQuery(window).height();
var current_width = jQuery(window).width();
if (current_height < window_min_height ||
current_width < window_min_width) {
jQuery('#dimensions_warning').show();
} else {
jQuery('#dimensions_warning').hide();
}
};
jQuery(document).ready(check_size);
jQuery(window).on('resize', check_size);
jQuery(window).on('beforeunload', function() {
if (opener && typeof opener.onClosePopoutChat == 'function') {
opener.onClosePopoutChat();
}
});
</script>
</head>
<body>
<div id="dimensions_warning" style="display: inherit">
<p>Minimum pixel dimensions required for site functionality are <strong>1366 x 768</strong>.</p>
</div>
</body>
</html>