window.getComputedStyle be able to get the actual style elements, but low and below ie8 version does not support, how is compatible with a similar function in version ie low

window.getComputedStyle be able to get the actual style elements, but low and below ie8 version does not support, how is compatible with a similar function in version ie low


// Get current style
function the getStyle (Element, ATT) {
    // characteristics of detecting
    IF (window.getComputedStyle) {
        // W3C specification precedence
        return window.getComputedStyle (Element) [ATT];
    } the else {
        // for less IE9 compatible
        return element.currentStyle [ATT];
    }
}
----------------
Disclaimer: This article is CSDN blogger original article "edison_ Xu", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/liang526011569/article/details/53363505

Guess you like

Origin www.cnblogs.com/wsj1/p/11919220.html