兼容获取元素当前样式 currentStyle || getComputedStyle

    function getStyle(ele, attr) {
      return ele.currentStyle ? ele.currentStyle[attr] :
        window.getComputedStyle(ele, null)[attr];
    }
原文地址:https://www.cnblogs.com/hello321/p/7819273.html