jquery 高度和宽度在 Internet Explorer 8 (ie8) 中返回不正确的值

标签 jquery css internet-explorer-8 height width

以下代码在 IE9+、Chrome、Firefox、Safari 中运行良好,但在 IE8 上运行不正常。它总是将列高度返回为 0,而宽度不正确。想法?

jQuery 版本:1.9.1

$(function ()
{
    $(window).load(function ()
    {
        // Megamenu
        $("#menu-primary > li").one('mouseenter', function (e)
        {
            var tallestColumnHeight = 0,
            submenuPanelTotalWidth = 0;

            $(".dropdown-menu > .dropdown-submenu", this).each(function ()
            {
                $(this).load();

                tallestColumnHeight = Math.max(tallestColumnHeight, $(this).height())
                console.log('tallest column ' + tallestColumnHeight);

                submenuPanelTotalWidth += parseInt($(this).outerWidth(true), 10);
                console.log('panel width ' + submenuPanelTotalWidth);
            }).height(tallestColumnHeight);

            $(".dropdown-menu > .dropdown-submenu", this).parent().width(submenuPanelTotalWidth);
        });
    }); 
});

文档类型是什么样的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

最佳答案

如果您使用的是 JQuery 2.0:它不再支持 IE 8。

关于jquery 高度和宽度在 Internet Explorer 8 (ie8) 中返回不正确的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16285964/

相关文章:

javascript - 小屏幕和大屏幕的 Bootstrap NavBar 不透明度

image - 在IE8/9中,缩放后的图像质量比在IE7中差

javascript - IE8 的 document.domain "permission denied"问题

javascript - 使用 jquery 在点击事件中查找表单

javascript - 对象内的函数导致错误

javascript - 如何使用 jquery 在 svg 之前附加图标?

css - CSS 的嵌套选择器在 IE8 中不起作用但在 IE6 中起作用?

jquery - 使内容在所有电话设备上都保持在一行中

javascript - 如何在新的 jsFiddle 界面中设置 jQuery 框架?

css - Safari 浏览器上的错误消息 - CSS 字体导入问题