改变元素透明度opacity

opacity: function(elem, val) {
    var setting = arguments.length > 1;
    if ("opacity" in elem.style) {
        return setting ? elem.style["opacity"] = val: elem.style["opacity"];
    } else {
        // if IE
        if (elem.filters && elem.filters.alpha) {
            return setting ? elem.filters.alpha["opacity"] = val * 100 : elem.filters.alpha["opacity"] / 100;
        }
    }
}

 

posted @ 2012-04-24 08:33  穆乙  阅读(510)  评论(0编辑  收藏  举报