getComputedstyle - IE8问题

时间:2014-03-05 23:56:29

标签: javascript jquery

如何使此代码在IE8中工作(如果可能,在下面)?

   return parseInt(window.getComputedStyle(indicator).getPropertyValue('z-index'), 10);

1 个答案:

答案 0 :(得分:2)

将其添加到您的代码中:

if( !window.getComputedStyle) {
    window.getComputedStyle = function(e) {return e.currentStyle};
}

此外,您可以使用getComputedStyle(indicator).zIndex以跨浏览器方式获取媒体资源。

相关问题