jquery - Respond.js 和 Modernizr 无法在 IE8 上进行媒体查询

标签 jquery modernizr polyfills

我有一个博客,我试图使用 bootstrap 作为该项目的 Backbone ,在所有浏览器上工作。我正在使用 Modernizr 和 Respond 来强制 IE 响应媒体查询,但由于某种原因,脚本无法正常工作。我是否将它们放置在错误的顺序中,或者是否有另一个 JS 脚本覆盖了它们?任何帮助将不胜感激。

    <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/library/css/bootstrap.min.css">
    <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/library/css/bootstrap-responsive.min.css">
    <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:700' rel='stylesheet' type='text/css'>
<script src="<?php echo get_template_directory_uri(); ?>/library/js/modernizr.full.min.js"></script>
<script src="https://raw.github.com/scottjehl/Respond/master/respond.min.js"></script>          
    <!-- HTML Shim - Enables usage of all HTML5 elements in Internet Explorer -->
    <!--[if lt IE 9]>
        <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script>window.jQuery || document.write(unescape('%3Cscript src="<?php echo get_template_directory_uri(); ?>/library/js/libs/jquery-1.7.1.min.js"%3E%3C/script%3E'))</script>

    <!-- Selectivizr - Enable CSS3 selectors for IE 6-8 -->
    <!--[if (gte IE 6)&(lte IE 8)]>
        <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/library/js/libs/selectivizr-min.js"></script>
    <![endif]-->
    <script src="<?php echo get_template_directory_uri(); ?>/library/js/bootstrap-tooltip.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/library/js/bootstrap-popover.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/library/js/bootstrap-typeahead.js"></script>
    <script src="<?php echo get_template_directory_uri(); ?>/library/js/site.js"></script>
    <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
    <!-- wordpress head functions -->
    <?php wp_head(); ?>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
</head>

最佳答案

尝试移动

<script src="https://raw.github.com/scottjehl/Respond/master/respond.min.js"></script>

找到最后一个样式表链接(您可能错过了,但底部有一个)。

关于jquery - Respond.js 和 Modernizr 无法在 IE8 上进行媒体查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13310209/

相关文章:

javascript - 如何从输入字段中的json中搜索数据

javascript - 如何从jquery中的任何选定对象获取属性

jquery - GoldenLayout,如何隐藏/显示组件?

css - 如何将 modernizr 用于边框图像

nuget - Modernizr3 的完整版本?

javascript - 查找包含选择器 id + 文本的元素

jquery - yepnope.js - 同一页面上的脚本有问题

javascript - Babel 能否使 Number.prototype.toLocaleString() 在所有手机上的 React Native 中都一样工作?

Angular 14 - Polyfills 不适用于旧版浏览器

gulp - 使用 Babelify 和 Browserify 在 Gulp 中添加 babel/polyfill