Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 缩放和转换转换不起作用_Jquery_Css_Wordpress - Fatal编程技术网

Jquery 缩放和转换转换不起作用

Jquery 缩放和转换转换不起作用,jquery,css,wordpress,Jquery,Css,Wordpress,我在这里看到了这个模板:并试图在这里的WordPress模板页面中实现:该插件/脚本正试图通过使用媒体查询来检测设备,该查询在主体上设置特定于分辨率的伪元素: var MQ = window.getComputedStyle(document.querySelector('body'), '::before').getPropertyValue('content').replace(/"/g, ""); 问题是,您的站点中没有包含相关的媒体查询,因此您的站点就像是在移动设备上一样。您需要在CS

我在这里看到了这个模板:并试图在这里的WordPress模板页面中实现:该插件/脚本正试图通过使用媒体查询来检测设备,该查询在
主体上设置特定于分辨率的伪元素

var MQ = window.getComputedStyle(document.querySelector('body'), '::before').getPropertyValue('content').replace(/"/g, "");
问题是,您的站点中没有包含相关的媒体查询,因此您的站点就像是在移动设备上一样。您需要在CSS文件的某个位置添加以下代码:

body::before {
  /* never visible - this is used in jQuery to check the current MQ */
  content: 'mobile';
  display: none;
}
@media only screen and (min-width: 1170px) {
  body::before {
    /* never visible - this is used in jQuery to check the current MQ */
    content: 'desktop';
  }
}

插件的作者可能已经指出了这一点。

你应该在这里发布相关代码。对不起,伙计,这是错误的/不完整的JS,我刚刚发布了当前在站点上排队的内容,我可以添加警报(“测试”);我看到一个弹出窗口,上面写着“测试”。这让我很困惑!你真棒!非常感谢你。我刚买了一些JS的书,我将在这个周末深入研究,希望我不会再错过这样的东西:)@bravesox哈哈,这是一个棘手的一个无论如何。通过基于控制台/警报的调试,您已经很有钱了。我只是在整个函数中插入了日志点,直到它们停止出现,这有助于我跟踪问题到
MQ
变量,从而找到缺少的CSS媒体查询。
var MQ = window.getComputedStyle(document.querySelector('body'), '::before').getPropertyValue('content').replace(/"/g, "");
body::before {
  /* never visible - this is used in jQuery to check the current MQ */
  content: 'mobile';
  display: none;
}
@media only screen and (min-width: 1170px) {
  body::before {
    /* never visible - this is used in jQuery to check the current MQ */
    content: 'desktop';
  }
}