0

我很困惑。我有一个非常简单的菜单,并且在mouseentermouseleavejquery 中使用slideDownandslideUp来显示一个子菜单。

它适用于从 Visual Studio 运行的所有浏览器(包括 IE)。当我将它推送到我们的 IIS 服务器时,它在除 IE(在 IE10 和 IE11 上测试)之外的所有浏览器上都能正常工作,这让我很困惑。

这是我的 _Layout 中的简单 jquery:

<script>
    $('li.liSlide').mouseenter(function () {
        $(this).children().next().slideDown();
    })
    $('li.liSlide').mouseleave(function() {
        $(this).children().next().slideUp();
    });
</script>    

示例子菜单:

<li class="liSlide">
    <a href="#">Batch</a>
    <ul>
         <li>@Html.ActionLink(((controller == "BatchSummary") ? "▷ " : "") + "Batch Summary", "BatchSummary", "BatchSummary")</li>
     </ul>
</li>

我尝试设置警报并更新一些 css 以测试 IE 是否正在进入这些功能,但事实并非如此。有谁知道我应该从哪里开始调试这个?我也可以发布更多相关代码。

4

1 回答 1

0

从这个网站上的另一个问题:

So for anyone out there who might run into the same issue and has to work with IE I solved the problem by adding this to my _layout.cshtml:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

What this does is instructs IE to use the latest available rendering engine to process the html (in other words don't try to be smart and guess what my html is built for). So it essentially tells the versions of IE that have 'compatibility mode' to not use it.

For me this works fine because our organization is small and we are usually within one version of the latest release of IE. If the latest version causes issues, I can easy fix and deploy with no harm done. However, this IS NOT optimal for a general purpose website or organization with high numbers of users on a variety of IE browsers.

这为我修好了。

于 2013-10-11T17:04:49.960 回答