jQuery无法在以IE7文档和浏览器模式运行的IE10中隐藏div [英] Jquery fails to hide div in IE10 running in IE7 document and browser mode

查看:95
本文介绍了jQuery无法在以IE7文档和浏览器模式运行的IE10中隐藏div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个小的jQuery脚本,用于查询url以查看其是否包含某些文本(在本例中为PL/SQL生成的参数和值).如果是这样,脚本将在页面内容中隐藏一个div并调整相邻的div以填充现在不存在的div留下的空间.我当前的问题是,由于某种原因,该脚本即使在所有其他浏览器中都无法在IE7中运行.

I have written a small jQuery script that queries the url to see if it contains certain text (in this case a PL/SQL generated parameter and value). If so, the script hides a div in the page content and adjusts the adjacent divs to fill the space left by the now absent div. My current issue is that for some reason the script isn't working in IE7 despite working in all other browsers.

    <script type="text/javascript">
      $(document).ready(function () {
        if(window.location.href.indexOf("p_ccp_path=APPLY") != -1){
          $(".page-content-right").hide();
          $("#right-col").css("width","60%");
          $("#icams-inserted").css("width","100%");
        }
      });
    </script>

我正在使用jQuery 1.10.2的本地化版本,并且可以在此处找到发生此错误的页面:

I'm using a localised version of jQuery 1.10.2 and the page on which this error is occurring can be found here:

http://tinyurl.com/jqueryError

有什么想法吗?

其他:

我已经检查了Firebug,没有任何错误.但是,当我检查IE开发人员工具时,它会出现以下错误:

I've checked Firebug and there are no errors. However, when I check the IE developer tool it comes up with the following error:

  SCRIPT3: Member not found
  jquery.min.js, line 5 character 8860

其他2:

从一些评论看来,这可能是IE10渲染为IE7模式的问题.我将在虚拟盒子上的IE7的Vanilla版本上对此进行测试,以确保确实如此.

From some of the comments, it appears that this may be an issue with the IE10 render as IE7 mode. I'm going to test this on a Vanilla version of IE7 on virtual box to make sure that this is the case.

推荐答案

看来这是IE10本身的错误,而不是我的代码中确实存在任何错误.在远程计算机上测试IE7的普通版本显示该脚本确实确实可以在IE7上正常运行.

It would appear that this is a bug with IE10 itself rather than there actually being any errors in my code. Testing a stock version of IE7 on a remote machine showed that the script does indeed work on IE7 without a hitch.

为了确保如果用户以兼容模式运行浏览器,该问题不会继续存在,我使用了以下元标记:

To ensure that the issue does not persist if users are running their browser in compatability mode, I have used the following meta tag:

     <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />

这可以确保通过使用"Edge"规范以IE兼容模式运行时,使用IE标准模式的最新版本.

This ensures that the most recent version of IE standards mode is used when running in IE compatibility mode through the use of the 'Edge' specification.

向@MythThrazz表示建议,它可能是IE10兼容模式的问题.

Credit to @MythThrazz for the suggestion that it may be an issue with the IE10 compatability mode.

这篇关于jQuery无法在以IE7文档和浏览器模式运行的IE10中隐藏div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆