需要最小像素尺寸警告信息

时间:2014-05-10 20:01:41

标签: warnings pixel dimensions minimum required

我正在尝试创建一种方法来警告用户他们正在以低于建议的分辨率查看页面/项目。

我找到的代码但无法完成以下工作。

<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>

0 个答案:

没有答案