码迷,mamicode.com
首页 > Web开发 > 详细

jQuery底层初探

时间:2017-09-01 12:44:47      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:turn   else   com   false   css   compute   方法   func   用法   

 

// jQuery的CSS()方法,其底层运作就应用了getComputedStyle以及getPropertyValue方法。
// getComputedStyle方法是只读的
// element.style能读能写


// getAttribute方法提供了与getPropertyValue方法类似的功能,可以访问CSS样式对象的属性。用法与getPropertyValue类似
// 返回 px,rgb
// 返回 em #fff


function getStyle(obj,attr,value){
    // value
    // obj.(attr)
    if(value){obj.style[attr]=value}
    else{
        if(obj.currentStyle){
            return obj.currentStyle(attr)
        }else{
            obj.getComputedStyle(attr,false)
        }
    }
};

 

jQuery底层初探

标签:turn   else   com   false   css   compute   方法   func   用法   

原文地址:http://www.cnblogs.com/alan-alan/p/7462647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!