Jquery 为什么@media screen和max width未命中在一台计算机上触发?

Jquery 为什么@media screen和max width未命中在一台计算机上触发?,jquery,css,wordpress,responsive-design,media-queries,Jquery,Css,Wordpress,Responsive Design,Media Queries,我在一个客户Wordpress网站上工作。最近,我注意到我的客户使用的一台计算机(只有一台)正在接受所有移动和小屏幕样式规则,甚至Javascript,这些规则正在检测小屏幕并动态更改页面上的样式和元素 下面是一些在Wordpress主题中硬编码的代码和规则的示例 CSS示例: @media only screen and (max-width:992px){ body { background-color: lightgreen; } /*And other s

我在一个客户Wordpress网站上工作。最近,我注意到我的客户使用的一台计算机(只有一台)正在接受所有移动和小屏幕样式规则,甚至Javascript,这些规则正在检测小屏幕并动态更改页面上的样式和元素

下面是一些在Wordpress主题中硬编码的代码和规则的示例

CSS示例:

@media only screen and (max-width:992px){
    body {
        background-color: lightgreen;
    }
/*And other styling for small screens here*/
}
if($(window).width() <= 992 || $('body').hasClass('force-responsive')) {

    //resizeTimeoutMenu = setTimeout(function(){   
        $('.main-menu > li.menu-item-has-children > a:first-child').not(".binded").addClass("binded").on("click",function(){
            $(this).toggleClass("mobile-menu-displayed");
            var parentContainer = $(this).parent("li");
            if(parentContainer.hasClass('menu-item-has-mega-menu')) {
                parentContainer.find('> .mega-menu').slideToggle();
            } else {
                parentContainer.find('> .sub-menu').slideToggle();
            }
            return false;
        });
    //}, 500);

}
例如:

@media only screen and (max-width:992px){
    body {
        background-color: lightgreen;
    }
/*And other styling for small screens here*/
}
if($(window).width() <= 992 || $('body').hasClass('force-responsive')) {

    //resizeTimeoutMenu = setTimeout(function(){   
        $('.main-menu > li.menu-item-has-children > a:first-child').not(".binded").addClass("binded").on("click",function(){
            $(this).toggleClass("mobile-menu-displayed");
            var parentContainer = $(this).parent("li");
            if(parentContainer.hasClass('menu-item-has-mega-menu')) {
                parentContainer.find('> .mega-menu').slideToggle();
            } else {
                parentContainer.find('> .sub-menu').slideToggle();
            }
            return false;
        });
    //}, 500);

}

if($(window).width()如果你
console.log($(window).width())
,你会看到什么呢?把这段代码放在
JavaScript
文件中:
console.log($(window).width())
。然后检查
JavaScript检测到的像素宽度。你不需要用jQuery指定单位吗?我在任何地方都看不到“px”。我要用浏览器缩放,点击
Ctrl+0
,听起来确实像是在进行某种缩放。尽管我认为这可能是一种系统设置,因为它在所有浏览器中都会出现.