lab.js jquery选择不同的版本

时间:2014-06-18 17:50:39

标签: javascript html internet-explorer-8

我正在使用LAB.js来加载一些脚本:

$LAB
.script("http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js").wait()
.script("script.js")
    .and_many_more_scripts;

由于JQuery v2不支持IE8,如果用户使用IE8,我需要一些条件来加载Jquery 1.11而不是v2。

现在,我正在使用这样的东西:

<!--[if lt IE 9]>
    <script src="html5.js"></script>
<![endif]-->

但我不知道如何在LAB.js中使用它。我是否必须为每个案例使用完整的LAB调用?

    <!--[if lt IE 9]>
    <script>
        $LAB
        .script("html5.js")
        .script("http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js").wait()
        .script("script.js")
        .and_many_more_scripts;</script>
    <![endif]-->
    <!--[if gt IE 8]>
    <script>
        $LAB
        .script("http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js").wait()
        .script("script.js")
        .and_many_more_scripts;
    </script>

1 个答案:

答案 0 :(得分:0)

结束这里寻找其他一些IE8问题,希望你现在能够找到问题所在。

但是,万一其他人需要,这对我有用:

$LAB.script((document.documentMode == 8) ? "IE8SCRIPTURLGOESHERE":"NOTIE8SCRIPTURLGOESHERE");

如果您只需要定位IE8,请将"NOTIE8SCRIPTURLGOESHERE"值留空:&#34;&#34;