Uncaught Typeerror:object不是函数 - Conditionizr

时间:2014-07-02 11:59:05

标签: javascript

对于我的生活,我无法看到我在哪里出错。链接:http://website-test-lab.com/sites/landstar/

我正在尝试设置Conditionizr,但我遇到了上述问题,而且'chrome'类没有添加到html标记中。

我的header.php看起来像这样:

<?php wp_head(); ?> 
 <script>                       

 conditionizr.add('chrome', ['class'], function () {
  return !!window.chrome && /google/i.test(navigator.vendor);
 });

 </script>
</head>

我通过functions.php调用conditionizr,并在上述调用之前将其添加到标题中。我删除了网站上的所有其他JS,但这没有帮助。我得到了同样的结果。

我不确定我哪里出错了?

非常感谢任何帮助。

感谢。

1 个答案:

答案 0 :(得分:1)

始终阅读the documentation.add()两个参数。您的配置属于.config

conditionizr.config({
    assets: '/path/to/my/assets/',
    tests: {    
        'chrome': ['class']
    }
});

conditionizr.add('chrome', function () {
    return !!window.chrome && /google/i.test(navigator.vendor);
});