有条件的评论在IE8中不起作用

时间:2014-09-14 15:52:16

标签: javascript jquery internet-explorer-8 twitter-bootstrap-3

我已经向IE8添加了有条件的评论,但它们不起作用,这是我的评论:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <script src="scripts/lib/json2.js"></script>
        <script src="scripts/lib/Object.keys-polyfill.js"></script>
        <script src="js/bootstrap-modal-width.js"></script>
    <![endif]-->

我已将警告消息添加到bootstrap-modal-within文件,但它没有响应:

    alert("Inside conditional comment");
var link=document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css');
link.setAttribute('href','css/bootstrap-modal-width.css');
document.getElementsByTagName('head')[0].appendChild(link)
$(document).ready(function(){
    addModalWide();
    $(".modal-wide").on("show.bs.modal", function() {
        var height = $(window).height() - 200;
        $(this).find(".modal-body").css("max-height", height);
    });
});

function addModalWide()
{
    alert("Inside addModalWide "+$modal.length);
    if(!$('.modal').length)
    {
        alert("Modal found");
        $('.modal').addClass("modal-wide");
    }else
    {
        alert("Modal not found,waiting 100 ms trying again");
        setTimeout(addModalWide,100);
    }   

}

0 个答案:

没有答案